All versions of Microsoft SQL Server (not MySQL). Please also add a version-specific tag like sql-server-2016 if that is relevant to the question.

learn more… | top users | synonyms (2)

4
votes
1answer
54 views

How to split a wide table in Production?

Due to some changing business requirements, I will be needing to split a large table in the near future to support new business requirements allowing a 1<=>M relationship from a table that was ...
0
votes
0answers
18 views

SQL Server doesn't send intermediate SSL certificates

I am connecting to SQL Server (2008 R2) over open Internet and properly encrypting the connection is essential. I have COMODO certificate with two intermediate certificates between root CA and server ...
6
votes
1answer
104 views

Is it important to make transaction log backups? [closed]

I don't have huge experience with SQL Server, I'm just studying it, and I have a question: Is it important to make transaction log backups? My database is not big, about 2GB, and I prefer a full ...
4
votes
1answer
82 views

There is insufficient system memory in resource pool to run this query

Over the past year we have been suffering a situation where many different queries at the same time will fail with the following error (or a variation in a different resource Governor group): There is ...
1
vote
1answer
28 views

Do I need different linked server remote users?

I have inherited a project that uses a local Microsoft SQL Server 2012 Express Edition and a central SQL Server 2012 as a backup. There may be multiple local "machines"/databases that all are linked ...
2
votes
1answer
41 views

Get start time and end time of a trip in SQL Server

I have a table that contains zone in and out information about a bus, and its structure is like this: id zoneid status datetime 1 35 IN 2016-02-02 11:36:39 2 35 OUT 2016-02-02 ...
0
votes
2answers
67 views

Concatenate column values [duplicate]

I have a query that uses a couple joins to get a name from another table. It works okay except that I would like to combine "Examiners Name" instead of having multiple duplicates: ID | Name ...
1
vote
2answers
66 views

Join SQL Server table in OPENQUERY on multiple keys

I need to join an Oracle linked server table (with 1 billion rows) with an SQL Server table (with 100 rows) on multiple keys: SELECT * FROM OPENQUERY(EDW, 'SELECT * FROM ORACLE_TABLE') A INNER JOIN ...
1
vote
1answer
33 views

Get Table Name from Transaction Log query

I can't figure out why this join isn't working to return the table name when querying the transaction log file. SELECT [Transaction ID], [Current LSN], PartitionId, sp.object_id, ...
1
vote
1answer
38 views

Compare Timestamp Difference Between Consecutive Records

How do I compare Timestamp difference between 2 consecutive records? This is my example: DECLARE @x TABLE(ProductID INT, SingleRunFailure bit, SampleDate date); INSERT @x VALUES (101, 1, ...
1
vote
2answers
45 views

SQL Server If statement assigning values [closed]

Please see the pseudocode below. Basically what I'm trying to do is write a statement that when an account number contains one of the specified codes it will assign that Level to the entire account ...
-1
votes
1answer
39 views

How can you allow only the database owner and system administrator to use a database? [closed]

I am on SQL Server Management Studio 2014. I need to allow me, the database owner and the system administrator to use a database. Also, can both users use the database at the same time?
3
votes
1answer
34 views

Grant Permission to Execute Set Transaction Isolation Level

I'm a part-time accidental SQL Server 2005 DBA whose full-time job is developing business intelligence solutions, but where the BI intersects with the database, it falls in my 'stack'. We have a ...
4
votes
2answers
55 views

SQL Server backup medianame

If I make full/differential/log backups to disk under full recovery model it is important to specify MEDIANAME? Is it true that MEDIANAME is only for tape backups? If not, when and why should I ...
-1
votes
0answers
22 views

How to recover with Veeam after CHECKDB fails? [closed]

I was wondering if anyone had any experience of recovering a SQL Server database after a CHECKDB failure and Veeam is your company's backup tool. Basically I want to know the process to restore the ...
0
votes
1answer
42 views

Copy table form MS-SQL server to MySQL, is it possible? [closed]

I have a procedure, say "proc1", inside a MS-SQL server. I would like to create a table (copy of proc1) inside a MySQL server. So far what I do is this: 1-Create a connection to MS-SQL Server 2- run ...
1
vote
0answers
44 views

Can I create a referential integrity constraint in SQL Server that prevents time overlaps? [duplicate]

It is trivial to create a Constraint on uniqueness for an integer value, but I am wondering if it is possible to create a constraint on overlap/intersection of a range of values. For example, my ...
0
votes
1answer
14 views

SQL Server backup media set and file separation

SQL Server backup media set and file separation If I am going to do such a backup plan under full recovery model for a particular database Weekly full database backup Daily differential backup ...
1
vote
1answer
38 views

SQL Server Import Export Wizard Error - Server throw Exception

I am trying to move all database tables from one db to another as a nightly job. The first (export) db is running sql server 2008 - SQL Server Authentication - I connect with SQL Server Native Client ...
2
votes
1answer
50 views

What can become a reason of database failure? [closed]

I'm the new one with SQL Server, so, please don't beat me. It's known that one of the best ways to protect your database from the failure is to make regularly scheduled backups. But my question is: ...
1
vote
1answer
28 views

Difference between database backup and data-tier application export

I don't know if this is a bad question, but I don't understand what the difference is between normal DB backups and data-tier applications in SQL Server. I know backups can't be imported from SQL ...
1
vote
0answers
40 views

SQL Server Repeatable read locking [closed]

I'm trying to understand the way the repeatable read isolation level works. I've been reading many articles and posts and still can't find my answer. Everywhere that repeatable read is mentioned, ...
0
votes
1answer
18 views

Howto remind and restore recovery mode during SSDT deployment?

Due to deployment of a SSDT database project I would like to be able to switch the target database's recovery mode from FULL to BULK LOGGED and back after the deployment finished in order to do any ...
6
votes
2answers
122 views

Selecting Distinct Rows but Counting All Rows

I have the following table: ---------------------------------------------- | ID | interestingData | timestamp | ---------------------------------------------- | 1 | 400 | ...
2
votes
1answer
76 views

Grant access only to System databases [closed]

Is it possible give an SA like permission minus any access to user databases? I want people to be able to collect information about Sql Server from the system databases but I want to make sure the ...
-1
votes
2answers
39 views

Stored procedure execute another sp with random value of parameters [closed]

For example: exec SpFirst @param1 = 1, @param2 = 'sdad', @randomSP = 'nameOfRandomSP @n1 = 1 @n2 = "2"' In SpFirst i use "exec @randomSP" but don't know how send to SpFirst send ...
8
votes
2answers
84 views

SQL Server 2014 Sudden Slow Down / No inserts/ Not related to hardware or index

I'm running a 350GB database on my PC with ~40 million rows. SQL Server 2014, Win7, AMD 8350 @ 4.8GHZ, 16 GB of RAM, and a 500 GB SSD (database is hosted on it's own 500 GB SSD, with a ...
1
vote
1answer
34 views

Normalizing a folder schema

I've created a schema to allow creation of folders for customers. Customers Id Firstname Lastname StreetLine1 StreetLine2 City CustomerFolders Id CustomerId ParentId (NULL) Name Now as you can ...
3
votes
1answer
44 views

What process would you use to determine references on a database that has no integrity?

Imagine you inherit a database which has a bunch of tables, no documentation and zero referential integrity. Now you're trying to find out what are the various relationships between different tables. ...
4
votes
1answer
248 views

'CONCAT' is not a recognized built-in function name

A client reported that they were running on SQL Server 2012, and we delivered some test queries for testing prior to a final delivery, however: 'CONCAT' is not a recognized built-in function name. ...
3
votes
1answer
62 views

Select data divided in groups evenly distributed by value

I would like to select into 4 groups the data from a table having the sum of a values in the groups as evenly distributed possible. I am sure that I am not explaining it clear enough so I will try to ...
1
vote
1answer
218 views

What does N'[Uncategorized (Local)] mean?

The following code is seen in several Q&A code snippets here (and elsewhere), I am trying to translate the section N'[Uncategorized (Local)] EXEC @ReturnCode = msdb.dbo.sp_add_category ...
3
votes
1answer
68 views

Where clause from OUTER APPLY using LEFT function

What would be a good alternative to improve my where clause that currently uses the LEFT function? Should I create a persisted computed column and an index to it? SELECT --columns-- FROM ...
5
votes
0answers
67 views

How to solve blocking on tempdb

I am having tempdb contention (I guess, at least) on one of the servers (SQL Server 2008 R2). Both the blocker and the waiters (10 of them) has PAGELATCH_EX wait type on database tempdb and all ...
2
votes
0answers
34 views

Cross database - Table valued Stored Procedure

I have the same table type in two databases (DB1 and DB2), DB1 has an stored proc (sp1) which has the above type as an input parameter. Now, I want invoke this SP from DB2. But, I am getting this ...
0
votes
2answers
42 views

Find database user name from sysprocesses

I know that this is a strange requirement but I need to find out database user name(not the login name) from sys.sysprocesses for all the currently running processes. For e.g. select spid,dbid, uid ...
-2
votes
0answers
11 views

What is the difference between Failover Clustering and AlwaysOn Availability Groups in SQL Server 2012 [duplicate]

I would like to know the differences between Failover Clustering and AlwaysOn Availability Groups in SQL Server 2012
6
votes
3answers
85 views

SQL Server Agent won't start

When I'm trying to start SQL Server Agent, I got this error: TITLE: Microsoft SQL Server Management Studio Unable to start service SQLAGENT$SQL_NAGA on server NAGA. (mscorlib) ADDITIONAL ...
-1
votes
2answers
58 views

Browse for Servers does not display local instance

I just installed SQL Server and SQL Server Management Studio but it doesn't show anything in servers list and I don't know how to connect to it. This shows that I have installed SQL Server: ...
5
votes
1answer
97 views

Datawarehouse indexing

I have a table with nearly 6m records. The business key that identifies a unique row is quite large. Our update processing is now taking a lot longer since I added this new table for a new cube. I ...
3
votes
1answer
55 views

SQL Server 2014 Batch Transaction Log Management [closed]

I have recently taken over a system which is going live in March on SQL Server 2014 after running on Sybase for years. The system is 24 x 7 OLTP and heavy batch at night. Prior years during batch in ...
2
votes
1answer
60 views

SQL Server 2014 Minimum Memory configuration - VMware

I am taking over a SQL Server 2014 environment which has been built and configured by a consultant. They have set a minimum value for memory which I usually set to 0. According to the consultant ...
9
votes
1answer
125 views

Why can my index seek estimate the right number of rows and the sort operator can't?

I've a query that uses a function on the predicate, something like this: commentType = 'EL' AND commentDateTime >= DATEADD(month,datediff(month,0,getdate()) - 13,0) I have a filtered index on ...
3
votes
0answers
28 views

How to PUSH data between a Local DB Server to Cloud DB Server?

I have an implementation doubt regarding replicating data between SQL Server 2014 database servers (Replicating data from Local Premises SQL Server to Cloud DB Server, which are not in same domain or ...
2
votes
1answer
32 views

String parsing: Extracting the filename from a URL

This is a link I have in a column of a table: http://earthexplorer.usgs.gov/browse/etm/1/11/2000/LE70010112000130KIS00.jpg There are like 1000's of rows like this. Is it possible to extract the ...
-1
votes
0answers
27 views

SQL Server 2005 patching issue

We are trying to patch SQL Server 2005 server with SP 4 cumulative hot fix 5324 for the first time in the server. Our patching wizard got hung for about 2 hours at this stage: Installing ...
3
votes
0answers
48 views

SQL Server Incremental Backups Split

I am trying to recover a database where the incremental (log) backups are split between two methods (Carbonite/Zmanda and SQL .bak files). When I try to use the restore wizard I get the following ...
0
votes
1answer
40 views

Copy A Database

Is it possible to copy a SQL Server 2008 Express without launching SSMS? Little more back-story: my internal drive was removed and is now used as a USB drive (upgraded to a larger hard drive) and ...
9
votes
5answers
267 views

Getting a scan though I expect a seek

I need to optimize a SELECT statement but SQL Server always does an index scan instead of a seek. This is the query which, of course, is in a stored procedure: CREATE PROCEDURE dbo.something ...
0
votes
1answer
29 views

Generic stored procedure for results sets comparison

Some of the tasks in my team are related to stored procedure optimization. I am mainly a .NET developer, but I thought of writing a generic procedure for data comparison while procedures are being ...