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
0answers
7 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
21 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
12 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
15 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
12 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
34 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
1answer
18 views

SQL Server 2012 - Powershell Agent Job Hangs

I have a SQL Server Agent Job on one of my 2012 SQL Servers which runs a powershell script inside the job step, where the 'Type' is set to powershell, and is running under the SQL Server Agent Service ...
0
votes
0answers
19 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
23 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
263 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
13 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
9 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
34 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
24 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
108 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
18 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
67 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
22 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
27 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
449 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
59 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
60 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
113 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
22 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
21 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
43 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
48 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
275 views

The fastest way to get the most recent records

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
25 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 ...
0
votes
1answer
23 views

Partitioned view with dedicated “routing” column

I have an application (Microsoft Dynamics NAV to be exact) that splits up data for different companies in tables with the exact same structure. I can not change that behavior, so I built VIEWs that ...
0
votes
0answers
31 views

2012, 2014 and 2016 SQL Server Licensing Costs [on hold]

I've looked for this information on various blogs because Microsoft's pages are unhelpful and very "selly". Does anyone have a side-by-side comparison of the licensing costs for 2012, 2014 and 2016 ...
1
vote
0answers
36 views

Change login name for all objects on server

Example, I have a create a windows login DOMAIN\GROUP01, and mapped that login to a database DATABASE01 with lets say DB_OWNER permissions I want to change the login name, I went into Active ...
-1
votes
3answers
191 views

Speeding up insert in SQL Server

I have a stored procedure which inserts some records in a few tables. In couple of tables at least , the inserted records number 10000+. Not more than 15K though. Takes 3-5 mins for this procedure to ...
1
vote
1answer
46 views

why sql server has high Worker threads? [on hold]

Product : SQL Server 2008 (SP4) CPU : 64 64-Bit system Worker thread configuration = 0 SCOM Alerts : SQL DB 2008 Engine Thread Count is too high After receiving this alert from SCOM i have ...
0
votes
0answers
15 views

Connecting database ISSUE to remote database in mssql [duplicate]

May be This question seems repeated but please read whole question carefully. I have Microsoft SQL Sever in one PC (ex. machine A) and I wants to connect and get data from that database from another ...
0
votes
0answers
25 views

How to implement SQL Server Service Broker with external activator

I am trying to execute an external app using SQL Server Service Broker and the External Activator provided by Microsoft. I have created the following script: IF EXISTS (SELECT * FROM sys.databases ...
0
votes
0answers
23 views

Query to Group By for a Specific Substring returning Only One Result [on hold]

I have the following query: Select count(*) as countForType, SUM(typeTable.amount) as totalForType, case when ( charindex('[', typeTable.source) > 0 and ...
3
votes
2answers
32 views

SSIS - How to parse extensions from path-filename strings

I'm importing a large set (126M rows) of file data from CSVs. Import works fine, except I'm trying to derive a column as I import rather than trying to script it out afterward (due to the number of ...
-1
votes
0answers
49 views

How do we convert SQL Server query to MYSQL? [on hold]

How do we implement this SQL Server syntax: IF(SELECT MAX(DateAdded) FROM RestoreDetectors " + " WHERE CONVERT(VARCHAR,DateAdded,101) = CONVERT(VARCHAR,GETDATE(), 101) " + " AND DATEDIFF(SECOND, ...
-2
votes
0answers
25 views

SQL server Database Consolidation [on hold]

What are the best practices for consolidatig multiple SQL Server databases into a single SQL Server machine? I have gone through many of different solutions but I'm unable to find the best solution. ...
0
votes
1answer
33 views

DBCC CHECKIDENT behaving inconsistently

I have a script that sometimes needs to be run on a fresh database that's just had all the tables created and sometimes needs to be run on an existing database. I have a script to wipe out the tables ...
2
votes
0answers
45 views

TSQL Generic Row number theoretical question

To start, We have a pretty complicated system that's been a compilation of over 20 years of code... And the code needs to work with SQL2005 all the way to SQL2014 (can't use the offset Fetch Next) ...
0
votes
1answer
31 views

Altering failed job email

I'm looking for a simple solution: if you have a job with multiple steps and one step fails but the job is set to continue, is there a way for the SQL Agent email to say which step(s) in the process ...
1
vote
1answer
48 views

Partitioning a table on a column in another table

I have a fact table called FactAccount which has the following columns: AccountId (identity) AccountMonthId - FK referring to DimMonth AccountYear The DBA has done the partitioning on the ...