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)

0
votes
1answer
11 views

First time database creation, for college

so I'm a student worker for my college and my department needs a database system to manage our records. While our IT and CS people are busy doing other things. I've been tasked to have a working ...
0
votes
0answers
5 views

SSPI handshake what does this mean [duplicate]

DESCRIPTION: SSPI handshake failed with error code 0x8009030c, state 14 while establishing a connection with integrated security; the connection has been closed. Reason: AcceptSecurityContext ...
2
votes
0answers
5 views

The transaction log for database 'database' is full due to 'LOG_BACKUP'. Nothing works

I have about 30 databases on SQL server 2012. One of the databases is erroring with "The transaction log for database 'database' is full due to 'LOG_BACKUP'." I have spent several hours googling and ...
0
votes
2answers
38 views

TSQL Delete All dates and stores data

This might sound like a stupid question but I can't seem to find a better way. It's a posting system where stores send us info on a daily basis (can be for multiple days). That info is placed in ...
0
votes
1answer
22 views

I would like to emulate the Microsoft SQL Server function GetSqlBinary() in MySQL version 5.6

I would like to emulate the Microsoft SQL Server function GetSqlBinary() in MySQL version 5.6. The C# namespace System.Data.SqlClient implements GetSqlBinary(), which is like fetching a blob.But the ...
0
votes
0answers
8 views

Odd service broker behavior

I have an established service broker relationship between two databases in our production environment. We do a weekly restore of these databases to another server for the purposes of testing our ...
2
votes
1answer
38 views

Behavior of case sensitivity of RAISERROR when run remotely

I have a remote SQL Server that I can connect to using a local instance of SSMS. When raising errors, we use RAISERROR( 'This works', 16, -1 ) Remotely, this works fine if it's all uppercase, or ...
0
votes
1answer
21 views

Does @@FETCH_STATUS have (or need) an equivalent to SCOPE_IDENTITY?

MSDN advises that @@FETCH_STATUS be used with care because it's global: Because @@FETCH_STATUS is global to all cursors on a connection, use @@FETCH_STATUS carefully. After a FETCH statement is ...
-2
votes
0answers
41 views

T-SQL Window over Window?

Ok, I already know window over window doesn't work, at least not on the same select. But I have this, almost a puzzle, to solve: (btw, that's a print in pt-BR, "soma" = "sum".) Columns N and O ...
4
votes
1answer
161 views

Logon Trigger preventing any connection

I was testing a logon trigger to restrict connections to certain IPs. It looks like the trigger was not correct. Now I can't log in to the server even as SA. Is there a way to fix this?
-4
votes
1answer
13 views

How long to keep order data in tables in a database [on hold]

How far back should you store data and when should you move the data off the production eCommerce site to a data warehouse? Can someone provide some links. I would think you would want to keep your ...
1
vote
1answer
30 views

Concatenate data in a single row [duplicate]

I have the following table: TicketID Type Code 44899B82-41C9-4020-9C2B-007C6000D283 ARTI 22150012 44899B82-41C9-4020-9C2B-007C6000D283 ...
0
votes
0answers
20 views

Limit number of entries written by Logon-Trigger

We are auditing connections to our SQL server by using a logon trigger. (SQL Server 2008 Standard Edition.) However what we are seeing is that there are always a number of entries logged for each ...
6
votes
4answers
179 views

Progress of SELECT INTO statement

Our ETL flow has a long-running SELECT INTO-statement, that's creating a table on the fly, and populating it with several hundred million records. The statement looks something like SELECT ... INTO ...
0
votes
0answers
16 views

SQL Server 2008 Patch Installer shows incorrect information

When running the SQL 2008 SP3CU16, on one of our instances, the install seems to run through the wizard OK. However, the Setup Bootstrap log reports "The patch installer has failed to update the ...
1
vote
1answer
21 views

Query XML without namespace

I can query XML, which has defined xmlns tag with common table expression DECLARE @XML XML SET @XML = '<NodeA xmlns="https://XYZ.xsd"> <NodeB verzePis=""> <NodeC1 attrA="Hello" ...
0
votes
0answers
9 views

SQL Server transactional replication distributor

If I have a SQL Server 2012, with two databases, both publishers, replicating to a bunch of subscribers. Can each database go through a different distributor? Is the publisher the server or the ...
-2
votes
0answers
26 views

Data retention and purge process [on hold]

how can i verify that purge process is working in database. Pls help any links or any information on it will be appreciated. I have SQL server 2012 database
0
votes
0answers
19 views

Restrict connection to SQL Server By IP [duplicate]

On a QA server I need to give access to specific login from just one IP to log to this server. I wrote This login trigger Create TRIGGER tr_CheckIP ON ALL SERVER FOR LOGON AS BEGIN ...
0
votes
0answers
16 views

SQL-Server Full-Text Index Auto-Population Stops Working

From time to time auto population stops working (SQL Server 2014 11.0.6518). I have to use ALTER FULLTEXT INDEX ON [table] RESUME POPULATION to make it work again. In the SQLFT*.LOG there is no ...
0
votes
0answers
13 views

How to pass parameters to a cmd.exe using Servcice Broker External Activator

I am trying to use SQL Server Broker External Activator to launch C:\Windows\System32\cmd.exe application and pass commands to it. For example: echo Hello World x 2 >C:\Test\cmd1executed.txt To do ...
2
votes
1answer
37 views

How can I create a role to create,update,delete stored procedures and views

what permissions do I need to give in order to achieve the above task to get users the capacity to create,update,delete stored procedures and views to a database role.
0
votes
0answers
20 views

Issues with the @query parameter in sp_send_dbmail

When I use the following: select * from table A where repID in ( select repID from table B where id = 5 ) as the string I'm assigning to the @Query parameter. ...
0
votes
0answers
24 views

Resource Governor - user in classifier function using NULL pool rather than stated pool

I have a problem with transaction log backups for an AlwaysOn HA database causing latch contention. It's not a problem when we run backups on the replica but we're not licensed for that, so I'd like ...
2
votes
2answers
272 views

SQL Server : Included columns in an Index: is there something like “too many”?

We have a table in one of our databases with approximately following structure: Field1 int primary key Field2 int foreign key A Field3 int foreign key B Field4 int foreign key C Field5 ... Field70 ...
0
votes
0answers
15 views

Changing MaximumErrorCount when executing maintenance plan

I have defined a Maintenance Plan in Microsoft SQL Server 2012. It doesn't execute and it says DTS_W_MAXIMUMERRORCOUNTREACHED. The Execution method succeeded, but the number of errors raised (2) ...
0
votes
0answers
10 views

Full text search error: Invalid locale ID was specified

Query involving full text search is generating the following error message after restoring the database to a new server: Invalid locale ID was specified. Please verify that the locale ID is ...
2
votes
1answer
37 views

Pros and cons of DBCC SHRINKDATABASE operation

I have read MSDN - Microsoft Manual according to this issue, but I still do not have clear understanding, when it is useful to apply this option and when it is not. Please advise.
-1
votes
0answers
29 views

What are the Pros and Cons of modelling a ready only query system with Multiple databases vs Multiple schemas?

I have the following scenario where an SQL Server database (D1) is being replicated to D1_p (on-premise SQL Server). I have another on-premise oracle database (D2) being replicated to D2_p (on-premise ...
3
votes
3answers
111 views

Install Express/Standard side-by-side

I've reviewed these two existing questions: Install SQL Server 2008 Express on same machine as normal SQL Server 2008 install? Installing SQL Server Express in parallel of Standard ...and I ...
2
votes
0answers
20 views

AlwaysOn Multi Subnet Configuration

Environment Two Nodes A & B A - Site/Subnet 1 B - Site/Subnet 2 File Share - at Site 3 We have an AG listener that has two IP addresses spanning the two subnets (1 up, the other down ...
0
votes
0answers
12 views

Enabling the use of OPENROWSET in Sql Server [duplicate]

I am trying to make my DEV Server allow the use of OPENROWSET. Though I can use it on my production but not in my DEV. I cannot use the Bulk insert because the excel file is dynamic (Column changes ...
3
votes
0answers
70 views

Sort operation SQL Server 2012

I am trying to optimize a query and the sort operation (91% cost) is the costliest operation. Any help will be appreciated. Query is : SELECT TOP 1 ArchiveType, CONVERT(NVARCHAR(30), ...
0
votes
0answers
23 views

Suitability of sqlite vs sql server compact or local db [on hold]

I am currently using sqlite with my C# application. The issue why I need this is for simple deployment using the clickonce. I could not use mysql here is cause of steps needed for its depolyment. I ...
0
votes
0answers
28 views

One bitmask column vs multiple bit columns [duplicate]

I have many tables with a column storing a set of days of week. I used to use MySQL and data type "set" worked well. For example: [worker] id weekday_mask (data type: ...
2
votes
0answers
30 views

Very high avg_write_stall_ms for tempdb [duplicate]

What could be causing (and how to fix) my tempdb files (8 equal size) to have [avg_write_stall_ms] of 7300ms and the next highest data file is 47ms. System is Hyper-V fail-over cluster, SQL 2012 ...
6
votes
1answer
458 views

What does SOS in SQL Server stand for?

I am reading SQL Server 2012 Internals book now. There are several phrases with SOS acronym, such as "SOS Scheduler" (in chapter about the scheduler), "SOS Memory node" (in chapter about the free ...
6
votes
1answer
60 views

Does SELECT INTO Reserve the #Object Name in TempDB Prior to Runtime?

Putting together a quickie proc to help with debugging, I ran into a what seems to be a error in the compiler. create proc spFoo @param bit as begin if @param = 0 begin select * ...
0
votes
2answers
61 views

How many log files does a database usually have? [duplicate]

I'm studying SQL Server. I have read that a database can have several data files and one log file, but recently I was heard that a database can have more than one log file. Is this true?
4
votes
2answers
130 views

How to optimize this tricky SQL self-join?

I want to perform a complex self-join on a table. I know that this could in theory be done very efficiently (see below), but I have trouble getting SQL (on Microsoft SQL Server) to do so. My question ...
0
votes
0answers
23 views

SQLAgent Job Step- Database field blank, but not

In looking at a historical SQL Agent job on my employers server I noted a job with 4 steps. The Databasefield was set as master for the step 1 and not set at all for the other 3 steps. Yet each of ...
1
vote
1answer
23 views

Synchronous SQL Server Replication only for specified subscribers

I would like to create database replication between multiple localisation. There will be one publisher and multiple subscribers. Is it possible to define that synchronisation is synchronous only for ...
0
votes
0answers
45 views

Equalize datafile size [on hold]

I have a DB (Microsoft SQL server 2008 R2 (10.50.1600.1)) that has 28 datafiles with all different filesize. Some are 10GB, some 15GB, some 27 GB, etc. The difference in filesize is a historical fact. ...
-2
votes
0answers
49 views

Want to setup full database in sql server 2012 [on hold]

I need to setup full database let say want to create tables, stored-procedures, cursors, functions etc. I have one xml file and all the related scripts. I need to know is there any way that I can ...
0
votes
1answer
26 views

What is the difference between unique, alternate and secondary keys in SQL Server? [on hold]

What is the difference between unique, alternate key and secondary keys in SQL Server?
3
votes
1answer
38 views

Why does Veritas backup take longer through CMDEXEC than cmd?

"c:\...\dbbackex.exe" -f "C:\...\backup.bch" -p policy_name -s server_name -np The above command, when run from command line takes something like 30sec to finish for a small db or transaction logs. ...
3
votes
1answer
25 views

Getting the referenced object from SQL Trace

I am able to query the default trace or any SQL trace for the event "Audit Add Role Event" to see if anyone has received any instance level access escalation. What I am trying to figure out is how to ...
-2
votes
1answer
27 views

I can't save Database Diagrams

I'm trying to save a database diagram but I'm getting an error. How can I fix this? Cannot insert the value NULL into column 'diagram_id', table 'SOFT.dbo.sysdiagrams'; column does not allow ...
6
votes
3answers
281 views

The fastest way to get the most recent records [duplicate]

I am looking for the fastest way to return the most recent record for each reference number. I quite liked the solution from BrentOzar.com, but it does not seem to work when I add a third condition ...
2
votes
1answer
26 views

High Log Space Used for model System database

I was running DBCC SQLPERF(LOGSPACE) and noticed that while my user databases have nice, low Log Space Used percentages, my model system database is currently at 98%. I have it set to the default Full ...