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
52 views

Identity column in columnstore index

I have an extremely large table IMO (~137 million rows) with lots of repeated data, lots of NULL columns, and such. I am considering exploring this using a table with a COLUMNSTORE INDEX and I have ...
0
votes
1answer
14 views

SELECT COUNT(*) to html table

This may be a very simple but its still not clear to me. I'm writing a SQL Agent job to generate output in html format. I need to get results of a query SELECT COUNT(*) FROM TABLE_NAME. I'm able to ...
0
votes
1answer
205 views

SQL Query - Possibly the most poorly written query in the history of mankind

Having a major headache trying to tune this query and looking for help, a programmer who had no idea what they were doing messed with this query and it is currently being used in production and it ...
6
votes
4answers
99 views

Find data size of table for several identical databases on a instance

I have several identical databases with the same schema/table structure within a instance. I need to find the size of one table that they all have. For example, I have 30 databases on a instance and ...
1
vote
2answers
180 views

Is it possible to set stand-by database to active, do changes and then continue restore chain?

Basically, I'm using a custom log shipping method on a sql 2012, where the transaction files are manually copied to an offsite location. The files are then restored using something similar: RESTORE ...
7
votes
2answers
367 views

How to “hack-drop” a database snapshot after SQL Server upgrade has botched it

I'm dealing with an issue where database snapshots cannot be dropped after SQL Server has been upgraded to 2014. The snapshots are defunct but cannot be dropped. Now although the Connect item has a ...
1
vote
0answers
21 views

SQL Server: dm_exec_requests.wait_time vs. dm_exec_sessions.last_request_end_time

We have a third-party Microsoft Access application that uses SQL Server 2012 as its data store. It is a well known issue that Access often does not tell SQL Server that it has received the results of ...
0
votes
2answers
2k views

How to set the timeoffset in a Datetimeoffset column without changing the date part

Is there any way to set the timeoffset of a datetimeoffset column directly without having to use SWITCHOFFSET which changes the date as well? In the post below, we can see the SWITCHOFFSET will ...
0
votes
0answers
746 views

how can I track down the source of “Internal connection fatal error”?

I'm working on a 6-700 line SQL script today. I'm running it from SSMS. Pointing at a SQL 11.0 db. About half the time I run it, I get: An error occurred while executing batch. Error message is: ...
1
vote
0answers
12 views

SQL Reporting Services (SSRS) - Blocked process on ReportServer, SP CheckSessionLock

We frequently see blocking on our SSRS box which houses both front-end Report Manager ReportingService and the SQL database engine with ReportServer & ReportServerTempDB Catalog databases ...
7
votes
4answers
4k views

Linked server error not caught by TRY-CATCH

I am setting up a job to loop through a list of linked servers and execute a specific query against each one. I am trying to execute the query inside a TRY-CATCH block so if there's a problem with one ...
4
votes
4answers
151 views

Routing data from one SQL Server to another

Is there a way in SQL Server 2012 to have data being written to one table routed to another SQL Server on another host? To clarify, we are using Hibernate Envars to write audit logs. Hibernate Envars ...
1
vote
1answer
42 views

Can I optimize a left join for a single match? [duplicate]

Consider a join A LEFT JOIN B ON A.id = B.a_id: B.a_id is nullable -- most but not all B records point to an A record. A can, at most, only have one matching B record (business logic). Not all A ...
0
votes
1answer
134 views

SSRS ReportServer_XXX.log is giving incorrect CPU count

I am currently investigating an issue wherein sometimes the SSRS just suddenly stops accepting requests until we do an IISRESET command. This happens after we added an additional processor on the ...
7
votes
4answers
161 views
+150

Why does my query search datetime not match?

select * from A where posted_date >= '2015-07-27 00:00:00.000' and posted_date <= '2015-07-27 23:59:59.999' But the result contains a record that has posted_date today: 2015-07-28. My ...
-2
votes
1answer
39 views

Business Date and Route Sequence

+-------------------------------------------------------------------+ |Route |Sequence| Planned Time | Business Date | ...
0
votes
1answer
41 views

Run Query Against All DB's on Server

I am trying to run this against all the DB's on my server and not just on "TEST_1". Is there a simple way to do this? Ideally the select would also return the DB name. use TEST_1 go declare ...
2
votes
4answers
2k views

Replication fails because of a non-existent foreign key

I have been trying to get a previously working replication to start working. I have tried many settings, but I can't seem to make it work. Here is the scenario. I dropped all the FK constraints ...
6
votes
1answer
5k views

Check progress of alter index reorganize / rebuild

How can I check the progress / status when I submit an alter index reorganize / rebuild ?
1
vote
3answers
39 views

SQL Server 2012 window function

I've the following table which holds status of jobs in a history table. JobHistory jobOrderId | dateAdded | Status -----------|-------------------------|------- 4909 | 2015-08-26 ...
-1
votes
1answer
23 views

Querying sys.master_files over a linked server

Querying sys.master_files through a linked server, I get no results. Why? How do I work around this issue?
1
vote
2answers
3k views

Getting current date as part of an Stored Procedure

I have the following SP: SELECT moncallAdd.FirstListing, DATEADD(MINUTE, mOnCallAdd.StartOnCallTime, DATEADD(DAY, mOnCallAdd.StartOnCallDate, '12/31/1899')) AS OnCallStart, ...
-1
votes
2answers
51 views

SQL Server : create table within stored procedure

I have a stored procedure that will be run by a user with public permissions. When operational, it will be called from an Excel spreadsheet and the results presented on a given tab. The procedure has ...
0
votes
1answer
19 views

Replication from log shipping database

I have a secondary database on a standby and read only mode. The question is .. Can I replicate this database ?
7
votes
2answers
25k views

IntelliSense not working but it is enabled

This problem is really proving to be a tricky one (and quite annoying). In SQL Server Management Studio 2008, up until a few days ago my IntelliSense was working great. Then all of a sudden it ...
1
vote
1answer
86 views

What collation to use for Ukraine?

We have an accounting program with an SQL Server database and would like to start a Ukrainian version. I am not sure which collation to use: Ukrainian or Cyrillic_General? With a non-technical ...
0
votes
1answer
20 views

How to Create Insert Statement from Table Data using sp_export_data without Id?

How to Create Insert Statement from Table Data using sp_export_data without the Id? I have the following statements and want to omit the Identity. How would I accomplish this? This is how I'm ...
0
votes
0answers
47 views

What happens to the database structure when i add a nonclustered index

Our team is working for a while now with Azure SQL. After a lot of trying , we managed to add a sync group between the main DB and the backup one. Of course, this means that for every change in the ...
7
votes
2answers
122 views

Should I mark a composite index as unique if it contains the primary key?

Given some table with a primary key, e.g.: CREATE TABLE Customers ( CustomerID int NOT NULL PRIMARY KEY, FirstName nvarchar(50), LastName nvarchar(50), Address nvarchar(200), Email ...
1
vote
2answers
54 views

Index planning for many columns with different usage

I've a table with 80 columns and that is a base table for most of the application. Daily load inserts almost 8,000 records and update upto 2,000 records. This table is now having more than 5 million ...
7
votes
3answers
311 views

Find the identity of the client firing a query in SQL Server without using triggers?

I'm currently using Change Data Capture (CDC) to track data changes, and I wish to track the host name and IP address of the client submitting the query that made the changes. If there are 5 different ...
0
votes
0answers
31 views

SSRS Migration 2008 to 2014 - InternalCatalogException secDesc != null

We're migrating side by side from SSRS 2008 Web to SSRS 2014 Enterprise. I followed the steps: backup encryption key backup databases (ReportServer and ReportServerTempDB) restored databases on 2014 ...
1
vote
0answers
13 views

Can i use PGP for securing My database

I have considered TDE and cell level encryption mechanism for securing my database. but these two cannot fully satisfies my requirements.through surfing i found that PGP may help me, but it is mainly ...
3
votes
0answers
14 views

Unable to uninstall Sql Server 2012 Express (With SP1)

My Stack: . Windows 10 Enterprise . SQL Server 2012 Express (with SP1 bundled). ISSUE: . Installed SQL to test for backward compatibility. . When I tried to Un-Install the following prompt is ...
2
votes
1answer
30 views

Can SQL Server Audit be used to track hostnames or IP adresses of the users performing DML on a table?

I have been reading about SQL Server Audit, and so far I have assimilated that it tracks the command that has been executed, and some other additional information(SPID, object ID and stuff). But can ...
3
votes
0answers
32 views
+100

Does RSS Profile has an effect on SQL Server with NUMA setup?

I'm curious whether the RSS Profile which is default NUMAStatic on Windows 2012 R2 could/should be changed for SQL Server with a NUMA setup. Has anyone done performance benchmarks on high load SQL ...
1
vote
0answers
35 views

Uninstalling MS sql server 2012 issues

I'm trying to uninstall ms sql server 2012. But when I click Microsoft SQL Server 2012(64 bit) and choose remove option it shows like this. Then how can I remove the MS SQL Server 2012? Please help. ...
0
votes
0answers
11 views

Sql Server remote connection to 2nd instance impossible

After installation of another SQL-Server 2014 instance to a server where a default instance of Sql-Server 2008 R2 is present, I cannot remote connect remote to the new named instance. The default 2008 ...
3
votes
2answers
57 views

Using sp_getapplock to implement a queue. Is it correct? Is there a better way?

I've been reading a series of posts by Paul White about SQL Server Isolation Levels and came across a phrase: To emphasise the point, pseudo-constraints written in T-SQL have to perform ...
1
vote
1answer
332 views

Can we use TDE as an anti-injection technique

TDE prevent unauthorized access to the data by restoring the files to another server, because it requires the original encryption certificate and master key. If i applied a table level encryption ...
2
votes
1answer
117 views

Updating large table worked before, now taking hours

BACKGROUND: I am using a non-production SQL Server to manipulate a large data set and run a few basic calculations. The original data file I have, which is about 30M rows, is missing records (not ...
18
votes
5answers
393 views

In Sql Server, is there a way to check if a selected group of rows are locked or not?

We are attempting to update/delete a large number of records in a multi-billion row table. Since this is a popular table, there is a lot of activity in different sections of this table. Any large ...
6
votes
3answers
76 views

Totals(sums/counts) across multiple child tables query optimization

We have 12 types of expenses in our database, some have fairly differing data minus the Amount fields. We have multiple places in the application and reports that require single and multiple expense ...
0
votes
1answer
103 views

Can scheduled and continous replication configurations exist side-by-side on the same master/slave servers?

Environment We have a core sql server cluster. This cluster contains some databases that get replicated to a load-balanced sql cluster of currently 3 servers. These databases are replicated each 12 ...
3
votes
1answer
33 views

sql server deadlock error - Shared (S) and Intent-Exclusive (IX) locks under Serializable isolation

Deadlock errors such as below happen frequently on our 3rd party vendor database: <?xml version="1.0" encoding="utf-8" ?> - <deadlock-list> - <deadlock victim="process743288"> ...
1
vote
1answer
35 views

How to measure the performance improvement that NUMA brings?

I am testing how one of our stored procedure is working on SQL Server Standard vs SQL Server Enterprise editions. I have created two virtual machines and install a SQL Server(SQL Server 2014) and ...
0
votes
1answer
20 views

Restore / Create a database with a data file (MDF) from backup the same but with two data files (MDF and NDF)

I must restore/create a db (in a new instance) in one file(mdf) from a backup of the same but with two files of data (mdf and ndf) How can I do it? This is what I try... but it did not work ...
3
votes
1answer
93 views

Select where bit is not 0

I have made the following query to select a record that isn't 0. SELECT * FROM Table WHERE Bit != 1 OR Bit IS NULL; Why is the check Bit != 1 not enough for a nullable BIT?
2
votes
1answer
65 views

Using a Linked Server to import data from Excel

I have read a lot about linked servers being bad when there are multiple hops across servers and distributed joins. What if I am just using a linked server to import data into SQL Server from an ...
9
votes
1answer
102 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 ...