Microsoft's SQL Server is a relational database management system (RDBMS) that runs as a server providing multi-user access to a number of databases. It originated from the Sybase SQL Server codebase, which is why both products use the extension of SQL called Transact-SQL (T-SQL).

learn more… | top users | synonyms (2)

3
votes
1answer
44 views

Can a High number of Worktables/sec and/or workfiles/sec lead to tempdb Contention?

We have a large number of very heavily used OLTP systems. One of our biggest issues right now is tempdb contention. I understand how creating many temp tables and table variables (which our developers ...
1
vote
2answers
34 views

Trying to filter msdb..sysjobs by job_id

I'm attempting to determine the name of the SQL Server Agent Job that is currently running by comparing the output of master.sys.dm_exec_sessions.program_name to msdb..sysjobs.job_id I'm using the ...
-1
votes
2answers
25 views

My database is missing and disappeared after detaching it

I have detached my database from SQL Server 2008 and unfortunately I do not know its path and by my connection string I extract its exact name and searched it but it is disappeared from my computer. ...
3
votes
1answer
56 views

Consolidating 2 Tables with same Values

I am working on a project trying to consolidate two databases, DB1 and DB2, for my organization into a single database, DB3. Initially our organization started with DB1. A few years back they made a ...
2
votes
0answers
43 views

AlwaysOn FCI + HA Setup Question

I am planning to create FCI + HA solution in the same datacenter, but running into some problems. I'd really appreciate if someone can provide some guidance. Here is the current configuration (All ...
0
votes
2answers
80 views

Stored Procedure null parameter within where clause

I want to use a parameter within where clause only if it's value is provided by strongly typed dataset, this is what I am trying at the moment, I get right results when I provide parameter3 and no ...
2
votes
1answer
47 views

Foreign key, key split in two tables

I have to record a list of events made of action, reason (optional, may be multiple), user. I have a master table with all the valid action, and another with all the valid action-reason combination. ...
1
vote
1answer
82 views

Why is there a collation conflict between system views

I'm using the following statement to retrieve a list of triggers from the database: select tr.name from sys.triggers tr union all select tr.name from sys.server_triggers tr; However on my local SQL ...
4
votes
1answer
360 views

Bad Design or Complicated Query?

Problem: For fun I am building a Database for lottery results to get some statistics off of. As of now I am only interested in a Pick 3 style lotto and might introduce more later. How would you ...
1
vote
0answers
29 views

Sql Server Installation Code Error

My problem is this, I want to Install Sql server 2014 in my Pc but i have a problem with it: SQL Server Setup failure. SQL Server Setup has encountered the following error: The SQL ...
0
votes
2answers
29 views

sp_send_dbmail with multiple reply_to addresses

I got this error when I specified multiple email addresses in reply_to The mail could not be sent to the recipients because of the mail server failure. (Sending Mail using Account 7 ...
3
votes
1answer
51 views

Online index rebuild LOB types

I have read and heard that you cannot perform online clustered index rebuild for tables that have a varchar(max) type. This (as I have read) also should be true for nonclustered indexes that contain ...
1
vote
2answers
76 views

What is better? Delete and insert or update? [closed]

I have a python script in which I have to update a column in 67000 rows. The value of the desired column can be unique for each row. I found that inserting 67000 rows takes about 5 seconds but ...
0
votes
1answer
29 views

Backup/restore using OPENDATASOURCE OR OPENROWSET

Has anyone ever successfully taken a backup or restore to another server using OPENDATASOURCE/OPENROWSET? I am not able to use linked servers so I am exploring this idea.
1
vote
1answer
43 views

Cursors and concurrent users

I typically avoid cursor operations like the plaque, however, I have come across my first problem where using a cursor outperforms a query. So I am forced to use it. I have created an elaborate ...
3
votes
2answers
164 views

Database User not reported as orphaned after Windows login dropped

I have dropped a SQL Server Windows Login. I then ran the below code to check for orphaned database users. However, the database user corresponding to the dropped Windows login does not appear as an ...
1
vote
0answers
27 views

SQL Server Real Time Data integration with different Instance

I have got a SQL application which needs to be merged with a new CRM applicaiton. so data coming into the source tables, then triggers push certain fields into the Staging table with a flag '0' and ...
3
votes
1answer
41 views

Copy database and clear down data (including linked tables) older than N days

I have a sizable production database (140GB) on MS SQL Server 2012, which I'm trying to automatically download to our development environments on a periodical basis (every week or on demand). I'm not ...
1
vote
0answers
20 views

How to tell if Database Certificate Used?

I plan to migrate a SQL Server database to another server. There is a certificate listed under the Security > Certificates view in SSMS Object Explorer. I ran the below query to check if database is ...
3
votes
1answer
63 views

FlushCache messages appearing in log at specific times

We've been having a lot of database performance issues lately, and I've been trying to see if I can figure out why. We don't have a DBA (I'm a software developer) so I'm sort of just winging it, and ...
3
votes
1answer
95 views

Optimized Way of Scheduling a Differential Backup

I am working with a data warehouse with SQL Server 2012 and was wondering what would be the most optimized, AUTOMATED procedure for a backup/restore strategy. Current observations and limitations: ...
0
votes
0answers
36 views

Adding Partitions to an Existing Filegroup

For maintenance reasons, the organization that controls the servers where I work has decided to limit the number of file groups and files for partitioning to just 1 of each. Their reason for this is ...
0
votes
1answer
32 views

SSRS minus first two dates as the header

I have a SSRS report that has one column called startime that is listed in mm:dd:yyyy hh:mm:ss format. For the header of this column I want to minus the first date from the second date to give me an ...
1
vote
0answers
17 views

Change Data Capture missing changes for a specific record

I have enabled CDC in SQL Server and it generally works well but sometimes the changes are not recorded for some reason. And only for a couple of records. But then if I issue an UPDATE from SSMS, the ...
2
votes
1answer
39 views

Failover Cluster Diagnostic Logs

I know there must be a simple answer to this question, but I cannot find it anywhere. Our SQL 2012 FCI have SQLDIAG .XEL files in their MSSQL\LOG folder. In some instances, these files are often ...
1
vote
2answers
41 views

Migrating CLR Assemblies

I am migrating a SQL Server 2008R2 database to a new server. (also 2008R2) There are a number of CLR assemblies on the server. Will these automatically migrate with the database or will I have to ...
1
vote
1answer
34 views

Linked Server and MSDTC on cluster

I'm trying to set up a linked server between two instances we have on our network. I've done this many times before without an issue, but this time I repeatedly get the following error: OLE DB ...
2
votes
1answer
59 views

Scripting a maintenance plan

I created a maintenance plan for my SQL Server 2008 R2 using SQL Server Management Studio (SSMS). However, I am unable to export/convert it to a script, in case I need to redo it on another server. ...
1
vote
1answer
44 views

Restoring a database, changing recovery model

I regularly make a backup of my production database, then restore the same onto a test database, so developers can always have recent data for testing. The production database uses full recovery ...
0
votes
2answers
51 views

How to escape '%' inside varchar @params for RAISERROR funcion in SQL Server 2012

How I should escape the % character in params so my RAISERROR retun my message declare @msg varchar(max) = (SELECT ' Message with % ' AS MSG) if @msg is not null begin RAISERROR (@msg ,16,1); ...
0
votes
1answer
102 views

Why straight SQL query run faster than stored procedure?

I am facing-out a very surprising problem in SQL Server. The problem is when the query run in SSMS window it will return result in ~1 sec and when the query run through a stored procedure it will ...
1
vote
1answer
101 views

The operating system returned error 665(The requested operation could not be completed due to a file system limitation)

Have a SQL Server 2014 instance running on Windows 2012 R2 that weekly runs Ola Hallengren's DB integrity scripts and the last two weeks started getting this error: DESCRIPTION: The operating ...
0
votes
1answer
37 views

Apparantly errorneous Exceeds 8K row length message

In attempting to alter an SQL Server table adding DATE and FLOAT columns. I get a message: Warning: The table "CustomerTransactions" has been created, but its maximum row size exceeds the allowed ...
0
votes
1answer
40 views

Logical problem with a database model

Beforehand the table names and columns are in spanish, my native language is spanish. I've got a database to manage the tickets sales of a trip that is made by a bus, the problem is that when i relate ...
1
vote
0answers
30 views

Does the order of columns in a non-clustered ColumnStore index matter? [duplicate]

I'm reading about creating a non-clustered ColumnStore index. I noticed that when I modify an already created non-clustered ColumnStore in SQL Server Management Studio I have an option to change the ...
2
votes
1answer
181 views

SQL Parameter Sniffing Possible Workaround

Our system has roughly 500 "Customers" that have extreme differences in record counts. Here is a (greatly simplfied) sample query that could return 0 - 100000 rows depending on the parameter passed. ...
0
votes
1answer
35 views

Difference between character_maximum_length and character_octet_length

Maybe there is an answer for this somewhere but, I couldn't find any efficient answer on Google for this question, therefore, I will ask this here. I wanted to get some information about my Stored ...
1
vote
1answer
62 views

Why is my filtered index being ignored?

--Setup, actual queries after the space --create table fltrind (a integer,b integer) truncate table fltrind DROP INDEX fltrind.nf DROP INDEX fltrind.f DECLARE @i integer SET @i=0 while @i<100 BEGIN ...
2
votes
0answers
28 views

How to add a missing database to an AlwaysOn Availability Group [duplicate]

Setup: Microsoft SQL Server 2012, and we have 3 production servers(prod1, prod2, prod3) with AlwaysOn. We recently added a new database and the new database was added to our Availability Group(named ...
2
votes
1answer
157 views

Partitioning Query

I have a couple of questions about the phyiscal layout of tables when they are partitioned. I've been researching this but am still a little unsure. Say I have an existing table:- CREATE TABLE ...
1
vote
2answers
29 views

Is there a policy or special server configuration to limit SQL Server query results?

I have been seeing developers using SELECT * FROM table when testing their queries. The issue is that many developers are executing such SELECT statements on huge tables, which slows down SQL Server ...
5
votes
1answer
163 views

Optimize for ad-hoc workload

I know what this option does and how to enable it. My question is what things will happen if I were to enable this. Without giving too much info, our accounting system is a Microsoft Dynamics ...
0
votes
2answers
51 views

SQL Server 2012 - Insufficient memory to continue the execution of the program. (mscorlib)

I have a sql file, which is up to 180 Mb. When I try to open and execute it on Microsoft SQL Server Managment Studio 2012, I am getting this error. . What do do ? I researched on Google. And there ...
0
votes
1answer
33 views

TempDB Query being Blocked

I have been monitoring Blocking issues on our SQL Server database. Very often the below query is running on tempdb and is blocked with LCK_M_S What is this query used for and why does it run ...
1
vote
1answer
43 views

Maintenance plan backup and reload the same database

I want in my maintenance plan every night to copy the production database to a backup, and reload the newly-created backup into a test database. By reading here: Restore database - maintenance plan ...
-1
votes
2answers
43 views

How to merge a column in single row in sql server

I have a following data: Comp_id | Cntm_nb | Seq_nb | Amount | Type 1 | 1 | 1 | 2000 | rent 1 | 1 | 1 | 200 | charge 1 | ...
0
votes
2answers
37 views

SQL Server Express Setup

I'm definitely a Database newbie and I'm trying to get SQL Sever Express set up so I can create and play with a database. I managed to install SQL Server Express 2012 before and It allready had the ...
4
votes
1answer
93 views

Why is SQL Server's online indexing causing blocking?

My understanding is that online indexing acquires locks at the beginning (Preparation) and end (Final) phases. However, we see a lot of DML queries blocked during the Build phase. A sampling of the ...
0
votes
1answer
35 views

Query Rows That Have a Following Row That Meets Criteria

Will try to do my best to explain this, as I don't really know how to word this to search for an answer. I'm a constantly learning but still newish SQL user who thus far has been able to solve most ...
0
votes
1answer
45 views

Delete from table where not in another table using two columns

I am trying to get my head around this delete statement I am trying to accomplish. I understand how to delete from table where column not in ( subquery to table2) I have two tables with multiple ...