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)

3
votes
3answers
142 views

Replication with FileStream

I need to setup database replication (for high availability) on a database that uses FileStream. This is on SQL Server 2012 Standard Edition, so Always On or Peer-to-Peer replication is not an option. ...
0
votes
0answers
6 views

How to restart the distributor agent of transactional replication?

After troubleshooting query time out error I would like to restart my distributor agent. So I go to my distributor server, in my distributor DB (called distribution_SA) I run the following query: ...
17
votes
5answers
475 views
+500

Retrieving n rows per group

I often need to select a number of rows from each group in a result set. For example, I might want to list the 'n' highest or lowest recent order values per customer. In more complex cases, the ...
2
votes
4answers
2k views

Cannot remove unused filegroups

I wanted to remove some unused filegroups/files in a SQL Server Database but am stuck because SQL Server thinks the filegroups/files are still in use. Some background: We had some partioned tables ...
5
votes
1answer
63 views

T-SQL brain teaser: find non-overlapping sets

I would like to ask for help coming up with a query, which can identify groups on non-overlapping records. Here is a sample scenario (admittedly contrived). Let's say I have employees who are ...
-1
votes
1answer
30 views

How to manage two tables in SQL Server [on hold]

i have two tables offer1 and offer2 The two tables are Offer1 Offer2ID|OfferName|OfferExpiryDate Offer2 Offer2ID|OfferName|OfferExpiryDate now i have third table which keeps record ...
2
votes
1answer
914 views

Connection to local SQL Server 2012 can be established from SSMS 2008 but not from SSMS 2012

I have two local SQL Server instances running on my local machine. The first is SQL Server 2008 R2 Enterprise Edition (named MSSQLSERVER) and the 2nd is SQL Server 2012 Business Intelligence Edition. ...
1
vote
1answer
40 views

Deleting duplicate rows with condition [duplicate]

I have posted a similar question before, but this one is a little modified. I have a table with 4 columns as shown below. ITEMCHARGE CPT4 EFF_DATE CPT4MOD 326.8 29075 ...
3
votes
2answers
188 views

use an Index correctly to optimize queries

I have an sql database with millions of records and when i'm querying the data like `select * from ActCosts where ScenarioID= 456` The tables has 1323718 rows and it gives me like 50,000+ rows ...
3
votes
2answers
76 views

How to identify unused databases on my sql server

I am looking for the best practices or analysis someone would have followed to identify the unused or inactive databases on my SQL Server. I went through many articles, which say possibly to go for ...
8
votes
2answers
200 views
+50

Improving the performance of STIntersects

Table T_PIN has 300,000 pins and T_POLYGON has 36,000 polygons. T_PIN has this index: CREATE SPATIAL INDEX [T_PIN_COORD] ON [dbo].[T_PIN] ( [Coord] )USING GEOGRAPHY_GRID WITH (GRIDS =(LEVEL_1 = ...
6
votes
0answers
34 views

Enabling TDE without breaking existing mirror

I've been trying to enable TDE in a mirrored SQL Server 2008 R2 configuration. Enabling TDE is not so difficult, though when I enable TDE on the principal, the mirror database goes in to a suspended ...
0
votes
0answers
10 views

Powershell Restore Azure SQL Database to local with Restore-Database

I have written a powershell script that uses Start-AzureSqlDatabaseExport & Get-AzureStorageBlob to export my azure DB to a bacpac and download it locally, the next step is to restore the bacpac ...
2
votes
2answers
3k views

How do I add a MySQL linked server to SQL Server?

I am trying to add a linked server on SQL Server to MySQL Server. Note the SQL Server is installed on a separate machine with a different domain name. The SQL Server is 10.0.1.1 on old_domain.com. ...
5
votes
2answers
424 views

SQL Server Full Text Search - .rtf files incorrectly indexed by rtf tags

I've set up a full-text index on my SQL Server DB on a varbinary(max) column. I have a type column specified, which contains the extension of the file, such a ".doc", ".pdf" etc. However, I have ...
8
votes
1answer
869 views
+50

How do I determine if a SSIS transform is non-blocking, partially blocking, or fully blocking?

There are several blogs which claim to categorize SSIS Transforms into blocking (asynchronous), non-blocking(synchronous) and partially blocking(asynchronous). When looking into the specific ...
0
votes
0answers
14 views

SQL Mirroring Down between Pricipal / Mirror

Configured MS-SQL Mirroring between two servers Pricipal and Mirror. Some times the connection goes down and start synchrozie automatically. Need to know which end either Pricipal or Mirror which one ...
2
votes
1answer
107 views

DTUTIL to package store

I am trying to deploy a package to a project in my SSIS catalog and am using the following command: dtutil /FILE C:\Changes\ReceivedEDI.dtsx /DestS MARSQL12 /COPY ...
0
votes
2answers
261 views

AWS RDS MSSQL Extremely Slow compared to EC2 with MSSQL

Background - I built a tool which grabs a lot of data from multiple third party APIs and stores it in a MSSQL DB. Then, I built a visualization to display this data in tabular and chart format. ...
5
votes
1answer
2k views

Error 18456 error severity 14 state 5 SQL Server 2012 SCCM2012 SP1

We had a primary site for SCCM 2012 SP1 running fine. I then installed CAS for SCCM on another server. The prerequisites required me to change the collation on the existing server. I did this and ran ...
1
vote
2answers
40 views

Deleting duplicate rows with condition(Using SQL and LINQ)

I have a table with 5 columnsID,CPT4,CPT4Mod,ItemCharge,Eff_Date. Deletion Condition: When rows exists with duplicate CPT4and CPT4Mod field values but different ItemCharge and Eff_Date values, ...
0
votes
1answer
46 views

Corrupt DB for a noob

Please help me! I am not a DB admin, and I have been thrust into the role after taking a new job. I need as much step by step as you can give me... I've already done the dbcc ...
11
votes
3answers
870 views

What is shared between two instances on the same server?

We want to install multiple instances of SQL Server on a single Windows server. We cannot use VMs because the server is bare metal Windows 2008 R2. For security purposes we need to ensure that the ...
3
votes
2answers
55 views

New Index on table cause table to be locked really often

Here are my tables : CREATE TABLE [dbo].[Trackers] ( [IdTracker] INT IDENTITY (1, 1) NOT NULL, [IMEI] NVARCHAR (16) NULL, [CreationDate] ...
1
vote
1answer
29 views

database design for simple comment

I have a following given scenario. A user can have zero or more item. A user can comment on the item. (Just simple comment listing with name of people who comment, no need hierarchical structure for ...
6
votes
2answers
146 views

Why doesn't a delete increase unused space in a table?

If I populate the following table: IF OBJECT_ID ('dbo.CleanTableTest', 'U') IS NOT NULL DROP TABLE dbo.CleanTableTest; GO CREATE TABLE dbo.CleanTableTest (FileName nvarchar(4000), ...
1
vote
2answers
592 views

Outer Apply vs Left Join Performance

I am Using SQL SERVER 2008 R2 I just came across APPLY in SQL and loved how it solves query problems for so many cases, Many of the tables I was using 2 left join to get the result, I was able to ...
1
vote
1answer
288 views

Cannot grant execute to stored procedure [on hold]

When I try to GRANT EXECUTE ON SP_NAME TO [DOMAIN\USER_NAME] on my database, I'm getting the error message below: Msg 8115, Level 16, State 1, Procedure grant_safety, Line 5 Arithmetic overflow error ...
2
votes
1answer
201 views

How to allow connections to SQL Server with 2 differents ip

I have a small issue here: I have a SQL Server instance 2012 (let's call it INSTANCE) on a cluster. I also have 2 network interfaces for this instance: SQLINSTANCE.my.metwork ...
2
votes
1answer
68 views

Installing SQL Server 2012 - Wait on the Database Engine recovery handle failed

I am installing SQL Server 2012 SP1 on a new Windows 8.1 machine. During installation I get this error: (Screenshots similar to this question) TITLE: Microsoft SQL Server 2012 Service Pack 1 ...
0
votes
1answer
72 views

how to select first 9 numbers from other table from database using sql query?

I want to fetch first 9 numbers from matching with other column please help me to find out thank you....? SELECT MAINFILE.facno,GLMAST.fglhead FROM MAINFILE INNER JOIN GLMAST ON ...
1
vote
1answer
23 views

How to join fixed row table against mapping table and reveal unmapped records

I have two tables and I am having trouble figuring out how to join them to meet my projection needs. Here is a scenario that illustrates the problem 1. The first table has a fixed set of values/rows; ...
1
vote
1answer
15 views

Shrinking old partitions

I have a large partitioned time series table where each partition is stored in it's own file. Since it's time series based partitioning divided by week and I'm only storing data that is new I have ...
0
votes
1answer
37 views

Turning multiple fields in column to row

I have an issue that has really stumped me in SQL Server. I have recently had the need to insert a row in to a table, made up from a number of columns. I want to make the one row up from something ...
3
votes
1answer
118 views

How do I identify the program that called a stored procedure?

As part of an application database design spec, we've been asked to block execution of a set of stored procedures if they have been fired directly from SSMS / osql / sqlcmd and so on; that is, they ...
0
votes
0answers
10 views

SSIS Execute SQL Task fails to login

I want to execute a SQL query in SSIS but when I try to build the query it says "login failed for user user". I executed the query in SSMS and it works fine and it also parses successfully . the ...
-1
votes
0answers
35 views

Equivalent data types in Oracle database for SQL Server 2008’s uniqueidentifier and timestamp

I am working on SQL Server 2008 R2, and I have data types which is specific for SQL Server, including: UniqueIdentifier Timestamp Now I want to deploy my asp.net mvc 5 web application on an ...
0
votes
2answers
142 views

Dynamic Creation of Table using Stored Procedure Without a Use of OpenRowSet in SQL Server

Q.--> An alternative of OpenRowSet in SQL Server Description: I have created a procedure which uses Dynamic PIVOT to get a result. I have a table which contains column DateRange with values Jan-2014 ...
4
votes
4answers
104 views

Conversion of a varchar data type to a datetime data type resulted in an out-of-range value

I am trying to run a simple query to get all rows created in November: SELECT COUNT(*) FROM dbo.profile WHERE [Created] BETWEEN '2014-11-01 00:00:00.000' AND '2014-11-30 23:59:59.997'; SMSS ...
7
votes
1answer
87 views

Is there a performance hit by breaking out tables into different schemas in SQL Server?

Is there any kind of performance hit when querying by placing tables in different schemas in SQL Server. For instance if I had 2 tables, Table1 and Table2, and put Table1 into the test schema and ...
8
votes
5answers
1k views

Using IF in T-SQL weakens or breaks execution plan caching?

It has been suggested to me that the use of IF statements in t-SQL batches is detrimental to performance. I'm trying to find some confirmation or validate this assertion. I'm using SQL Server 2005 ...
5
votes
3answers
7k views

Howto use Windows Authentication with SQL Server 2008 Express on a workgroup network?

I have two computers running SQL Server 2008 Express: c01 and c02, I setup both for remote connection using windows authentication. Worked fine for c02 but not for c01. This is the error message I'm ...
2
votes
1answer
62 views

Sql Server Backup to URL (Azure) ERROR

I'm trying to take advantage of the new backup to url function in SQL Server. I have created a valid cert and tried a simple backup, but I get the same error every time no matter what I try. I have ...
2
votes
3answers
3k views

Restore SQL Server database using Windows Powershell 3.0

I'm trying to restore a SQL Server database with a PowerShell script, but I'm having problems. Here is the error I'm getting: Exception calling "SqlRestore" with "1" argument(s): "Restore failed ...
34
votes
6answers
28k views

What are the main causes of deadlocks and can they be prevented?

Recently one of our ASP.NET applications displayed a database deadlock error and I was requested to check and fix the error. I managed to find the cause of the deadlock was a stored procedure that was ...
14
votes
1answer
3k views

How to get the MAX row

In SQL Server I've always found it a pain to get the max rows for a dataset, I'm looking for a list of the methods to retrieve the max rows with some guidance on performance and maintainability. ...
0
votes
2answers
66 views

SQL Server 2012 Very Slow to Consume Memory

I have a bit of a conundrum. I recently upgraded a ~20gb database from Window Server 2008 R2 || SQL Server 2008 R2 to Window Server 2012 || SQL Server 2012. The previous server had 32gb of memory, ...
4
votes
1answer
29 views

How do I determine the spid of the session that is making a query on a linked server?

I have a session running on a SQL Server instance that is blocking other sessions (holding on to a lock without releasing it). Querying sys.sysprocesses yielded the hostname of a different SQL Server ...
0
votes
2answers
3k views

Problems during installation with Database Engine Service

Overall summary: Final result: Failed: see details below Exit code (Decimal): -2061893606 Start time: 2014-07-04 13:40:51 End time: ...
2
votes
0answers
37 views

Exclude a User From an Audit

I need to set up a SQL Server audit to capture all database activity for all logins except one - the login our application runs under. In this case the login I want to exclude is CPSDOM\cpointedb. In ...