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)

4
votes
1answer
25 views

Find rows where data resets

So I have a table tbl where I'm trying to pull data that increments at a variable rate. I need to identify when the data resets so I can make a cumulative value. Here's an example table: ID VAL ...
4
votes
3answers
75 views

Reseed identity column in all empty tables

I need to write a query that resets the identity on all tables that have an identity column and are empty.
1
vote
0answers
25 views

Why are SELECT queries in sleeping status holding open transactions

Using sp_WhoIsActive, I see that I have a lot of processes in a "sleeping" status, several for hours. I am not sure of the cause and am still troubleshooting (timeout? bad code with uncommitted ...
1
vote
1answer
27 views

Dump all Views of multiple databases in MS SQL

I need to export the views from multiple databases of an older server. (Essentially, to generate a list of views using a particular piece of SQL. ) The fastest way I've found thus far is to manually ...
0
votes
1answer
28 views

Cannot Decrypt the encrypted columns from the database backup on local machine

I've a SQL server 2014 running on one of our server. We're in the process of implementing security steps for our databases. I've encrypted a column in one of the table in the database on the server. ...
2
votes
0answers
14 views

Transaction log bloat when writing to table on replicated database with parameterized filter

We are observing abnormally large log writes whenever we update a table that is used for parameterized filter in a merge replication. There are a number of join filters as well. When executing a ...
0
votes
0answers
6 views

grant execute on xp_logevent to sa using sa user to do it

Running a SQL Server 2012 CLR Stored Procedure with this code: const string executeLog = "EXEC master..xp_logevent @errorNumber, @message, informational"; using (SqlCommand cmd = new ...
2
votes
1answer
8 views

How to change location of SQL Server 2012 database which is already configured with a merge replication

I have SQL Server 2012 configured with merge replication. currently the location of the replication database and the .mdf and .ldf files reside in C:\ drive. The C:\ drive is now full due to that ...
2
votes
0answers
46 views

Leap second in Database system (Postgresql and SQL Server)

This night will be longer because of leap second: https://en.wikipedia.org/wiki/Leap_second My impact will be minimal in my case, I don't even know if I will recive some weird data like 20150630 ...
1
vote
0answers
19 views

Unable to connect to SQL Server on AWS

We have two Sql database servers (windows 2008 datacenter r2) with same name but with different IP. can it be possible? we are not able to connect second one which we have created after. Both are on ...
7
votes
2answers
165 views

Migrating from text and image to varchar(max) and varbinary(max)

I have a SQL Server database which contains a number of image and text columns, and I'm studying potential problems that might arise from migrating them to their non-deprecated counterparts ...
3
votes
3answers
142 views

Make a column for each count(*) in a day of the week

I have a table of people who are doing piece work. Every entry in the table has a user-ID, name, and a Date for each report they enter. I need to make a weekly report of what these people have done ...
1
vote
1answer
57 views

What is the best option to easily fix fragmented heap indexes?

I have SQL Server 2008 R2 SP2 and also SQL Server 2012 SP2 on these servers. I have a database in which there is a lot of heap indexes which are more than 90% fragmented. What is the best option ...
3
votes
1answer
35 views

Insert a range of numbers from a call to sp_sequence_get_range

Given the following code: CREATE SEQUENCE dbo.NextTestId AS [bigint] START WITH 10 INCREMENT BY 2 NO CACHE GO DECLARE @variableNumberOfIdsNeeded INT = 7, -- This will change for each call ...
6
votes
2answers
368 views

Why is SQL Server 2014 consuming so much RAM with no active data stored?

I'm running SQL Server 2014 on my laptop along with a ton of other installed applications, from Visual Studio to video games. This is obviously not a production server, but for development and ...
0
votes
1answer
33 views

Filtered index throwing error - UPDATE failed because the following SET options have incorrect settings: ANSI_WARNINGS

While executing proc1, I am getting error as below: UPDATE failed because the following SET options have incorrect settings: 'ANSI_WARNINGS'. Verify that SET options are correct for use with ...
4
votes
0answers
16 views

Move content between filestream containers

I have a server running SQL2012 with Multiple Filestream containers on a single table. I need to split one of the existing filestream containers into two parts by creating a new filestream container ...
3
votes
1answer
45 views

Mirror db from production to test and acceptance nightly or weekly

I have read this Easy or Schedulable way to move data from Production to Test and it seems not automated. I would like to have a daily or weekly push of my production server data to one or two ...
0
votes
0answers
31 views

SQL FullText Search and pdf

First of all, thank you for comming here : I wrote a script in SQL able to find words in a file, with a lot of help of some websites ...
0
votes
0answers
11 views

All actions denied on MS SQL Server on Go Daddy Hosting

i have a website hosted on GoDaddy and I need to create a database for it. So headed to the Databases section and created a MS SQL Database then on my local pc I tried to access the database via SQL ...
2
votes
1answer
28 views

Hyper V replication - vs - sql replication solutions

I need to establish an offsite copy of a number of production servers, including SQL server. Hyper V replication has been chosen as a simple solution (all servers are virtual). This is to supplement ...
0
votes
0answers
20 views

Using fetch is it possible to take the first n rows based on a grouping column

I am using pagination concept to fetch the list of records using Fetch. But I have a problem here. Since I am using split on in my API,I will return redundant records from the stored procedure. My ...
2
votes
2answers
59 views

concatenating columns from multiple unrelated 1-row resultsets

Assume I have these two queries in SQL Server 2014, both of which return one row from unrelated tables: SELECT SUM(A) A, SUM(B) B FROM X SELECT SUM(C) C, SUM(D) D FROM Y I'd like to combine these ...
0
votes
2answers
44 views

SQL Server Database recovery from corrupt database [on hold]

Last week I backed up my SQL Server by using Backup Exec 2012. I named the file "SQL Server BAK" which contained copies of my SQL Server databases. A few days ago I lost some part of my data due to ...
1
vote
1answer
50 views

Least Privilege for SQL Agent to run DISKPART

The DISKPART script SELECT DISK 1 ONLINE DISK runs fine as long as SQL Agent has admin rights on the server; otherwise the script fails with this message: Message Microsoft DiskPart version ...
0
votes
1answer
23 views

Redirect Connections to a SQL Instance

I have a LAN in which clients connect to the SQL installed on a Server with the IP address of 192.168.1.10 (SERVER_A) . I have another SQL instance installed on another server with the IP address of ...
1
vote
0answers
33 views

SQL Server vs Oracle [on hold]

I am transitioning from SQL Server DBA to Oracle DBA. I have minimal experience with Oracle, and I have found that the best way for me to traverse if by correlating terminology and database engine ...
2
votes
1answer
26 views

Table structure for validating data using category and subcategory fields

I am creating a simple budget application, and the primary table will be a transaction table that contains things like the amount of the transaction, date, account, the category and subcategory (the ...
1
vote
1answer
36 views

SQL Server: Time Series Table Design

I am creating a time series database that follows the table structure here: Storing intervals of time with no overlaps. The difference with my design is that the FinishedAt column changes every time ...
0
votes
0answers
89 views

Datediff with many dates causes poor performance?

I am a system programmer and entered the forum to understand a little more of the database. Currently I picked a query with a lot of data and I had to check there is a gap between today's date and the ...
4
votes
2answers
53 views

Strange looking where clause in sql server

I've found fa strange looking code in T-SQL. Here is the strange looking part: WHERE @term1 IS NULL OR (@term1 IS NOT NULL AND (businessLogicCondition)) The query works well, but what is the point ...
0
votes
0answers
23 views

msdb.dbo.sp_start_job got stuck in stored procedure

I have a stored procedure USP_A with logic like following: ...... BEGIN TRY exec dbo.usp_Log 'Start to run job job1' Exec @intErrorCode = msdb.dbo.sp_start_job 'job1' IF @intErrorCode <> 0 ...
3
votes
2answers
243 views

Is there a standard for naming foreign keys when two columns reference the same table? [on hold]

I've always used the name FK_CurrentTableName_ReferencedTableName. I just ran into a situation where I've got a table with CreatedById and ModifiedById both pointing to the same (users) table, so this ...
1
vote
2answers
32 views

Reorganize Index Task [on hold]

Can the Reorganize Index task (maintenance plan or SSIS package) be used to tune performance? Is this an adequate step of triage for degraded application/query performance?
4
votes
1answer
120 views

How do I choose the right job owner?

This morning I had three failed jobs (no biggy) used for custom reporting DOMAIN\USER is no longer with the company. Error Message The job failed. Unable to determine if the owner ...
3
votes
2answers
85 views

check when last backup was taken

Brent Ozar had an interesing newsletter on 2015-06-22; How do you manage dbas measuring backups, where he thinks that a good DBA should check when the last backup was done it was last restored ...
0
votes
0answers
14 views

unsigned right shift '>>>' Operator in sql server [on hold]

How to write unsigned right shift operator in sql server? The expression is like value >>> 0 Here is the e.g. -5381>>>0 = 4294961915
0
votes
1answer
23 views

how to set default value of column 0 when NULL is inseerted

I have a table with a column which has default value to 0. However when null is inserted to this table, I want it to set it to default. As the insert query is generic and used by other databases too, ...
2
votes
0answers
23 views

Why my database mirror break down after changing file group settings from RESTRICTED_USER to MULTI_USER?

My environment is the following: VMWare 5.5 vitalized server MS Windows Server 2008R2 Enterprise domain and SQL Server 2008 R2 Enterprise. Centralized storage with fibre-channel connection. I have ...
2
votes
2answers
77 views

Conceptual ERD Multi-table many to many, or possibly recursive?

I'm creating a conceptual diagram [yes, I know I've included attributes and keys - but this is just for me to consolidate what I'm doing whilst learning] -- so please treat it as Conceptual with the ...
-2
votes
0answers
25 views

Keep connections alive when disconnected from network

In SQL Server, is it possible to keep a connection alive if the end user was disconnected from the network? Specific situation: If I am working with SSMS and create a temp table - is there a way to ...
-3
votes
0answers
27 views

Create database in SQL Server 2014 [on hold]

I have installed SQL Server 2014 on my laptop and I have not created new databases in SQL Server 2014 yet. Before creating a database, should I first create a private key and a certificate? If so, ...
0
votes
1answer
27 views

BCP - Different Schema

I have a transactional Replication (Non-SQL Server Publishers - Oracle) implemented for one SQL Server Database. Let's say Publishers: A, B Subscriber: C Note: I can not modify the Oracle DBs. The ...
4
votes
0answers
61 views

Which to trust?

We are troubleshooting a long-running issue with a vendor. Their software has a tendency to freeze up and stop working once or twice a week causing major disruptions to our operation. They have been ...
0
votes
1answer
22 views

SQL Server : multiple databases with transaction log on one SSD array

I know for HDD arrays that having multiple log files from different databases has a performance hit as it changes the IO pattern from sequential to random for the array. So having an array per ...
-5
votes
1answer
24 views

How to copy my SQL Server 2008 database [closed]

In my SQL Server 2008 copy database option is not present. Can you help me to copy the database?
2
votes
0answers
35 views

How to verify replication data integrity in SQL Server when using external replication engine

I am looking for a way to verify that data I am replicating between SQL Server databases is making it to the destination OK. Data is being replicated using an external replication engine, no built-in ...
0
votes
3answers
29 views

Merge replication throws PRIMARY KEY violation during the initialization of Subscriber

I am using SQL Server 2014 SP1 to set up merge replication on Windows 2008. The databases (Publisher & Subscriber) are restored from the production back up of SQL Server 2005 publisher database. ...
-1
votes
0answers
42 views

Need Review - Index Rebuild and Index Reorganize strategy?

I've written a block of code to design Index Reorganize and Index Rebuild strategy based on following recommendation. I'm considering only Clustered and Non-clustered index, not Heap. Does anything ...
1
vote
1answer
47 views

Alternatives to SQL Server TDE

Due to the high cost of SQL Server Enterprise Edition which includes the Transparent Data Encryption feature I am looking for an alternative product and have only found a couple of options: ...