SQL Server 2012 (major build version 11.00.xxxx). Please also tag sql-server.

learn more… | top users | synonyms (3)

1
vote
0answers
46 views

Multiple conditional counts in the select clause - what's the best way?

(Bit of a long one, sorry) To set the scene: N.b. This is on SQL SERVER 2012 We have a table [CardLog] in an access control system database. Every time an ID card is printed, a row is added to this ...
1
vote
2answers
46 views

Find times when table is least frequently used

I would like to analyse performance of one of the big tables in the database. There are only two types of operations on it. Inserts and reads. Once data is entered it is never updated. I need to ...
4
votes
2answers
46 views

A lot of ad-hoc queries impact on server

We have a third party application which generates a lot of ad-hoc statements (our server has 16GB of memory and there are 140000 ad-hoc queries present in the cache).I've enabled 'Optimize for Ad-hoc ...
1
vote
1answer
154 views

Cannot install database engine services, replication and SQL writer

I am trying to install SQL Server 2012 Express, but I get this error (I try to uninstall and delete registry key, try to change account for database engine to NT Authority\System, but reinstall still ...
0
votes
1answer
43 views

Restore Database Wizard not launching

I'm using SQL Server Management Studio 2012 and trying to use the 'Restore' functionality to copy an existing database into a new one. This is something I've done a dozen times before, but I'm ...
3
votes
2answers
45 views

Can I tell SQL Server not to place data in the buffer cache?

One of the servers I support has an ETL job that runs every morning. This isn't an SSIS package, just a series of stored procedures executed via SQL Server Agent. The job takes several hours to run, ...
0
votes
0answers
16 views

Diagnosing SSBDIAGNOSE?

When trying to connect SSBDIAGNOSE from a command shell to a named instance on the same server(to which my Windows Login has SA), I receive an error e.g. SSBDIAGNOSE CONFIGURATION FROM SERVICE ...
0
votes
1answer
24 views

Create a job that sets Auto Update Statistics on

I am using SQL Server 2012. The vendor wants Auto Update Statistics set to false, but my boss wants it set to true. If I set it to true, after a while it goes back to false by itself. I think the ...
1
vote
1answer
58 views

Forcing correct execution plan when passing a table UDT to a table function

I have a scalar function that returns a big XML, created over a bunch of invoices. The exact list of invoices to feed to the function can be calculated using several different ways, but the function ...
1
vote
1answer
41 views

Merge Two Group By Rows SQL

How do I merge two rows returned by a Group By statement: Select SiteId, SiteName, EventCount = Count(*) From #MyLogs GROUP BY EventCode, SiteId, ...
1
vote
3answers
39 views

Which one to consider for upgrade SQL Server 2008 vs SQL Server 2014 or Compatibility level 100 vs 110

I need to upgrade the SQL Server 2008 to SQL Server 2014 . SQL Server 2008 is currently running on compatibility level 100. I need to upgrade to SQL Server 2014 with compatibility level 100 this year ...
1
vote
1answer
97 views

What is the role of eager writer?

What is the role of eager writer? How this process works internally in SQL server? What is the major difference between eager writer and lazy writer/checkpoint? My understanding here is, that both ...
3
votes
0answers
66 views

SQL Server 2012; Incorrect PLE buffer manager value for NUMA server

We are receiving PLE alerts from SCOM for several instances. These instances are on hardware servers, and use NUMA nodes. SQL Server 2012 SP1 CU7 Enterprise Edition is installed. Memory is fixed and ...
0
votes
0answers
72 views

Set database offline with rollback immediate takes an hour to complete

Every night we take our production database offline, detach it, and then re-create it to sever any connections as the start of our backup procedures. The first command is: USE master ALTER DATABASE ...
1
vote
2answers
62 views

SOS_SCHEDULER_YIELD - Prevent a Proc from giving up the Processor Time

I've got a process which about once a month at times unrelated (or as far as we can tell) goes into SOS_SCHEDULER_YIELD State. This process blocks our main data entry pipeline and brings the entire ...
0
votes
1answer
41 views

Using Partial String match from one query results in where clause for another SQL Server 2012

I need results field of query1 to drive I have one query that produces a table of several columns, namely "Time_stamp", "Value", and "Name" from two existing tables. Select TOP 20 ...
2
votes
1answer
29 views

Multi-Server Extended Events investigations

Do you happen to know if there's a method of centralizing the Extended Events information of many servers in one place (for easier administration and diagnostic). Ideally I would like to have ...
0
votes
0answers
37 views

AlwaysOn Error and Redo Queue

Recently one of our synchronous AlwaysOn Groups stopped replicating data and went into a Non Synchronising state. In the dashboard on the primary everything was showing as OK, but on the secondary ...
-2
votes
1answer
55 views

Trigger is not working in SQL Server 2012 on runtime? [closed]

In SQL Server 2012, I create two tables TABLE1 and TABLE2 After that, I created a trigger for TABLE1 Trigger name: PUSH_TABLE2 After creating the trigger PUSH_TABLE2, I test with below insert ...
1
vote
1answer
96 views

Ola Hallengren's Backup solution error message after moving files using cmdexec stops job, this disagrees with faq

I am using Ola Hallengren's Maintenance script, and I am having an issue which seems documented in the FAQ. For context, there was an issue where the existing SQL Server backups had to be moved to ...
1
vote
1answer
53 views

Transaction log rollback broke Log Shipping chain?

Is it correct that performing a transaction log restore to a previous point in time will break the log shipping chain? If this is correct, is there a way to recover from this situation without having ...
2
votes
1answer
52 views

I want to find out in SQL SERVER 2012, who is creating SQL Logins and on which date

I was trying to find out in sql server 2012, who created login and which date. Can any body help on this thanks,
7
votes
2answers
377 views

Average of last 4 runs of a product

I need to show the average weight of a product over its last 4 production runs. I'm not sure how best to describe it other than an example: Let's imagine I have the following table that lists a ...
1
vote
2answers
75 views

I need to log activity of the sa account

I need to log the activity of the 'sa' database account via Microsoft SQL Server 2012 so I can review the activity periodically and look for strange behaviour for audit purposes. Unfortunately I'm ...
5
votes
1answer
34 views

Statistics on filestream column

When I try to create a statistics on a filestream column, I get the following error message: Column 'MyColumn' in table 'MyTable' is of a type that is invalid for use as a key column in an index ...
1
vote
2answers
34 views

How to return all the unique column values on a per column basis for all metadata tables?

assume multiple tables of various sizes table one col one, col two, col three,... a,d,j a,e,k a,e,m b,e,o c,e,o d,e,o f,e,o return (preferably in this format) col one, col two, col three a,d,j ...
3
votes
1answer
160 views

Split Date/Time value for Night Shift Employee

This is a follow up to my previous question: First-In and Last-Out times for Night Shift Employees I am a beginner in SQL. I tried this query and CTE, but I cannot get my desired output: SELECT ...
1
vote
1answer
94 views

Why SQL function always returning empty result set?

Following function I have write which accept xml and returns table as result. CREATE FUNCTION FunctionTest(@ID INT,@XML_Details xml) RETURNS @RESULT TABLE ( Value1 INT, Value2 INT ) AS BEGIN ...
5
votes
3answers
562 views

Find all IP's or users who access a specific SQL Server

Let's say I found a SQL Server and I have no idea which applications connect to it. Maybe I find one application but I am not sure if it is the only one using it. Is there a nice way of finding all ...
-2
votes
1answer
132 views

Error 35338: Clustered columnstore index is not supported [closed]

On SQL Server 2012, I want to index a table with a columnstore index. But an error message apears: Msg 35338, Level 16, State 1, Line 1 Clustered columnstore index is not supported. My code ...
2
votes
1answer
82 views

Column Name in separate table SQL Server

I am working with an accounting package backend. In SQL Server 2012 there is a custom fields table with Values (see sample below) and another table with custom header names (see sample below). I ...
1
vote
0answers
32 views

What's the deal with transactions in a stored procedure called by an SSRS report?

Consider the following: sp_a contains an sp_executesql call to exec sp_b sp_b begins and commits a transaction, then immediately logs @@TRANCOUNT. When I call sp_a manually from within SSMS, the ...
6
votes
1answer
112 views

Why would a procedure sometimes hang executing SELECT…INTO #Temp2 FROM #Temp1 JOIN LocalTable…?

We have several stored procedures, called by jobs, that follow a specific pattern (designed to minimize blocking). Some of these procs tend to hang on occasion, running up the CPU, tempdb allocations, ...
3
votes
1answer
160 views

How many rows can a SQL Server 2012 table hold, and when should I partition it?

Say a table stores granular data about some event. It has the date of the event, a type dimension with around 30K types, and a category dimension with around 100 categories, plus some numeric facts. ...
11
votes
1answer
821 views

Why is adding a NOT NULL column with a default constraint instantaneous?

CREATE TABLE TestTab (ID INT IDENTITY(1,1), st nvarchar(100)) INSERT INTO TestTab (st) values ('a') INSERT INTO TestTab (st) values ('b') INSERT INTO TestTab (st) values ('c') INSERT INTO TestTab ...
1
vote
0answers
176 views

SQL Server 2012 Cluster Service pack 3 fail to failover node

Roughly a year ago, i had this problem with an 2008R2 cluster. I asked about it here, but i didn't grab enough logs in the process. And now i have the same problem on my 2012 failover cluster. So i'm ...
3
votes
2answers
50 views

How to get the size of a spatial index?

I want to see the size of a spacial index. I am usually using one of the following code blocks to get the indexes sizes of a given table, but none of them is working for a spatial index. DECLARE ...
1
vote
0answers
73 views

Improving the performance of procedures showing warnings for implicit conversions

We have recently migrated from SQL Server 2008 R2 to SQL Server 2012 Standard Edition. We and witnessing poor performance related to quite a number of stored procedures running against a database that ...
3
votes
2answers
187 views

Measure compilation time of stored procedure

I need to measure how much time it takes for the MSSQL-2012 to compile a stored procedure. Is it possible?
0
votes
1answer
104 views

Apply SP3 on SQL Server 2012 AlwaysOn AAGs

If Always-On is configured, while applying Service Pack, should I: Directly move SQL Server Instance (Secondary Replica) to make it passive and apply Service Pack Or First move Availability Group ...
1
vote
1answer
43 views

Always-On Configuration Clarifications

Do we have to Install stand-alone instances of SQL Server 2012 or Failover-Cluster SQL Server Instances while configuring Always-On? I am asking this question because I saw few configurations using ...
0
votes
1answer
66 views

Setting up log shipping with an availability group

In my production environment I have a SQL Server 2012 AlwaysOn AG. The Server1 there is database "MessagesDB" and in an AG to secondary Server2 (in synchronous mode). I want to setup log shipping ...
0
votes
0answers
29 views

SSIS buffer size and table with many columns

I have an Oracle view with around 10 million rows, each row has about 130 columns, I wrote a SSIS 2012 package which uploads the data of this view into a SQL Server table. The SSIS package fails each ...
3
votes
1answer
85 views

Add a total quantity column for groups of rows

I have an Items table and an Inventory table. An Item can belong to multiple Inventory records. I'm trying to return a list of ALL Inventory records but with their quantity in a new column. For ...
2
votes
1answer
56 views

SSMS: possible to script 'file per object' into categorised folders like in object explorer?

e.g. if you run the 'generate scripts' function (by right clicking on a db in object explorer) to script out an entire database, it creates all the files in one folder and annoyingly names them as ...
7
votes
2answers
217 views

Finite State Machines in SQL

I'd like some input on an issue I'm having. We have a section of code that we repeat throughout our stored procedures, and every time it takes quite some time to process, and when combined the number ...
3
votes
1answer
75 views

Login issue in Logshipping

I have configured log shipping in my primary serverA and secondary serverB. Everything works fine until I bring the standby database online. Users are not able to login to the secondary serverB ...
0
votes
1answer
36 views

Error when trying to start Mirroring

Thanks for looking at this, and thank you in advance for any answers! I am attempting to start a mirroring session, but I am getting an Error 1418, which basically states that the TCP port doesn't ...
1
vote
1answer
24 views

Changing replication snapshot folder, require re-snapshot?

We have SQL Server 2012 SP2 running on Windows Server 2012. We need to change the snapshot folder for all (including default) transaction replication publications. I have read that this means the ...
1
vote
1answer
15 views

execute as login for nonexistent login successful

On Sharepoint database server, we found 18456 state 11: infrastructure error for account Domain\machineA$ every 10 minutes and nt authority\anonymous every hour. I checked syslogins but didn't find ...