Tag: sql-server-2012

Declaring insensitive cursor in sql server 2012 with sp_executesql

I have a stored procedure that makes use of cursors; it was written in SQL Server 2005, and worked fine until SQL Server 2008. We recently decided to move to SQL Server 2012, and tried to move all our databases to the new environment, but this stored procedure fails on opening the cursor. Here is […]

Explode linestring to line segments in SQL Server

How can I explode linestring to line segments? Line string like: ‘LINESTRING(0 0, 2 2, 0 2, 0 5)’

SQL – Grab record with minimum date until cost changes

Got a record set where I’m looking to grab the record with the minimum date based on PO until the cost changes. Any help would be appreciated. There are around 7 million records and the current cursor just isn’t cutting it. Sample: PO log_Ts cost 123 2012-06-26- 2.5896 123 2012-06-27- 2.5896 123 2012-06-26- 2.591 123 […]

SQL 2012 – Common Table Expression – Hierarchy – List All Children Before Parents

I have a problem that I’m trying to solve that I think is different from other SQL adjacency list hierarchy problems I’ve researched here. I’m trying to sort the data such that all children are listed before any of their parents. I already have CTE’s that return all the children of a given ParentID and […]

best practice: reportservers and sql servers

we have three SQL servers serving a variety of applications on different webservers. Each application is using reporting services functionality. The average load per server per month is about 40.000 reports, taking an average of 3.1 secs to deliver a report. At this moment the the situation is as follows: Application A has his database […]

How to determine cubes which use particular dimension?

Performing changes to dimensions is always a risk for me if I don’t know exactly which cubes will be affected. Is there a more elegant way to do this than checking every cube one by one or creating an external documentation? I would generally like to know if there is a way to do it, […]

Standard Deviation of the column with day wise

I need a query to find the standard deviation for a column with daywise. My table has some 30,000 rows with the timestamp of every 10 mins. Please find the below sample data with columns timestamp and TF. i need to get the deviation for rest of the columns as well Timestamp TF 2012-05-17 19:15:35.000 […]

Avoid filling identity gaps after migration

I have migrated a series of tables from an SQL Server 2008 to a new SQL Server 2012 machine via Transactional Replication. That works fine so far and I also replicated indexes and default values to ensure the replicated data is equal to the original one. When I detach the new machine from replication to […]

How to make permanent auto select intellisense results sql server 2012

Right now it is filling results via intellisense as you type But it is not auto selecting When you hit ctrl + alt + space at the same time, it starts auto selecting as you type for only that query I want this feature to be permanent Here image of both scenario no auto select […]

1:1 relationship in SQL Server Management Studio 2012

I want to create a 1:1 relationship in SQL Server Management Studio 2012, please help me, can’t find the correct way, every time I try it creates a one to many relation.

MS SQL Server is a Microsoft SQL Database product, include sql server standard, sql server management studio, sql server express and so on.