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)

1
vote
1answer
2k views

Wrong error in SSIS - [Execute SQL Task] Error: There is an invalid number of result bindings returned for the ResultSetType: “ResultSetType_Rowset”

I have an Execute SQL task which gives returns only one row with one column - a number. I set my result set to single row. Despite that, the task fails. Why ? How do I fix it ? [Execute SQL Task] ...
9
votes
2answers
1k views

Do natural keys provide higher or lower performance in SQL Server than surrogate integer keys?

I'm a fan of surrogate keys. There is a risk my findings are confirmation biased. Many questions I've seen both here and at http://stackoverflow.com use natural keys instead of surrogate keys based ...
1
vote
1answer
2k views

How to flush SQL Server database from RAM to hard disk?

As part of the nightly maintenance plan, my working MS SQL Server 2012 databases are backup-ed with options of simple recovery and full backup. Transaction log is not backup-ed. Also, at nights the ...
3
votes
2answers
3k views

Snapshot for transactional replication taking too long for large database

I want to establish a transaction replication of a large database (200GB). But when I create the publisher and the snapshot agent starts, it takes very very long time and it sticks on the following ...
1
vote
1answer
6k views

Error on changing ownership of database from Files Page in database properties dialog box

I've restored a database and created a new user(same user from which I've logged in) as db_owner. Now when I wanted to see database diagram got an error Database Diagram support objects cannot be ...
2
votes
1answer
109 views

Will cleaning data cache help to resolve compiler memory pressure?

I currently experience RESOURCE_SEMAPHORE_QUERY_COMPILE waits causing CPU spike 100% that lasts 10-20 mins and disappears only by completely stopping traffic. I figured it could be a memory pressure ...
0
votes
3answers
919 views

Production (20GB+) Database running slowly and timing out

I know the title thread is a bit ambiguous (and my first post here!) but I am having a very severe production database problem. I am not a DBA, though I know how to work with queries and SQL Manager. ...
0
votes
1answer
56 views

Warn about table recreation on table change

By default, if you try to change a table using the designer making any of the following changes, you get an error message: You change the Allow Nulls setting for a column. You reorder columns in the ...
0
votes
3answers
1k views

how to grant select access my sql server

when I exec the syntax to gain the access I get an error that I cant grant permissions to my self. any Ideas please!
0
votes
1answer
1k views

How to create login and logout trigger for client audit?

I need a table to put login and logout information for client not sysadmin,then i can use date to statistic user login/off ration... Can anyone offer me a simple method to create login and logout ...
0
votes
2answers
2k views

Xml stored as varbinary

I'm wondering if I have to store a XML information inside a column (just storing, not for querying ) (SQL SERVER) which Datatype is better to use XML or Varbinary? I did an example: DECLARE ...
2
votes
1answer
870 views

Convert SQL Server query to MS Access syntax

I have this query in SQL Server: SELECT Dated, AccountID, AccountName, Rate, case (when (Credit-Debit) > 0 then Credit-Debit END) as Credit, case (when (Credit-Debit) < 0 then Credit-Debit ...
1
vote
1answer
281 views

Database Tuning Advisor user permissions

I was asked to create an account to use Database Tuning Advisor. I red on technet but I don't understand which permission do I have to give. I tried to login with this new user, but trying to list ...
1
vote
1answer
264 views

How to insert and or update a variable number of records and prevent concurrency issues

I currently have the following stored procedure. However I am seeing some race conditions where I end up with incorrect data which I think is caused because the procedure isn't attomic and it can be ...
1
vote
2answers
309 views

What's the official successor for sp_resetstatus in case of a SUSPECT database?

I have a database that has been marked SUSPECT because the volume that both the data and the log file were on suddenly disappeared (an accident - this is a developer workstation). I tried bringing the ...
1
vote
0answers
536 views

storing arrays or images in a database table

I'm a beginner with both database design and use of forums such as this one so forgive me if I forget to provide some relevant information below. Basically I'm trying to store a set of arrays, in ...
5
votes
3answers
3k views

SQL Server 2005 get execution plan of a overnight stored procedure

There is a overnight job runs long time. I have used profiler to get the trace and identified a statement (in a stored procedure) that takes most of execution time. Now I need to see the execution ...
0
votes
2answers
2k views

Updating an indexed column performance impact in SQL server

I am trying to understand is there any performance impact if I am trying to update a column which is the key column of a non-clustered index in SQL server 2008? For e,g I have a column IsActive in ...
5
votes
1answer
1k views

Failover scenario with principal “hard down”

My company has a failover pair of SQL Server 2005 instances, which provide database availability for a UL-licensed alarm/call center, where uptime and availability are critical for life safety. ...
1
vote
0answers
117 views

MS SQL Server: Can Unicode columns include non-unicode values?

I need to convert UNICODE column values from UTF16-LE to UTF-8 to then import into MySQL. Is it safe to assume columns of NVARCHAR, NTEXT, NCHAR, BIT, INT, DECIMAL, FLOAT, and DATETIME all MUST be ...
3
votes
1answer
528 views

Is it possible to filter the list of databases in the Object Explorer of the SSMS?

I know how to filter the list of tables - using the filter icon. However, this icon is disabled when the Databases node is selected. Still, I am wondering whether it is possible.
0
votes
1answer
110 views

SQL Server Transaction Log File [duplicate]

I am currently in an live environment and I am trying to clear some disk space. I noticed that a SQL Server database transaction log file is kinda big (12GB). The recovery model of that database is ...
1
vote
0answers
4k views

How to speed up query on table with millions of rows

The Issue: I'm working on a big table that consists about 37mln rows. Data include measurements of many devices made in certain time e.g. '2013-09-24 10:45:50'. Each day all of those devices are ...
1
vote
1answer
60 views

Creating Multiple Indexes on SQL Server [closed]

I am creating multiple indexes on a table in SQL Server. The script is still executing but all the required indexes are showing as objects in Object Explorer. Do the objects get created before the ...
0
votes
1answer
196 views

Does failed task considered to be run to completion in SQL Server maintenance plan terminology?

The replies to my previous question: "How to specify a SQL Server maintenance plan subtask to run unconditionally on success or failure of preceding tasks?" answered me that I should change ...
1
vote
1answer
715 views

dcexec login failure

I have a SQL Server 2008 R2 instance that I have been trying to get Data Collection setup on. I get everything setup, but there is no data that gets uploaded. I've traced the root of the problem to be ...
3
votes
1answer
3k views

Max Memory settings on Multi-Instance SQL Server 2008 R2 Cluster

SQL Server 2008 R2 multi-instance cluster (on VMware vSphere 5.1) 2 nodes, each running 2 instances 16GB RAM per node. The only time the instances are on the same node is when I am patching the ...
2
votes
1answer
79 views

Why would an index covering only half of primary key be useful?

We have a primitive junction table to store a many-to-many relation between two other tables, their primary keys being bigint: CREATE TABLE [dbo].[JunctionTable] ( [ID-1] [bigint] NOT NULL, ...
1
vote
0answers
46 views

Default Trace activity object not in database listed

I've been collecting information on the default trace however i've noticed something strange. Below is a what i'm running , DECLARE @trc_path VARCHAR (500) SELECT @trc_path = CONVERT(VARCHAR ...
1
vote
3answers
1k views

How can I get a list of tables contained in a database diagram?

I need to get a list of the tables contained in a diagram in SQL Server. How can I do it using an SQL script? I don't need a list of tables in the database, but the list of tables contained in a ...
5
votes
2answers
2k views

How to specify a SQL Server maintenance plan subtask to run unconditionally on success or failure of preceding tasks?

I am having a (rather standard) daily maintenance plan created with SQL Server Management Studio Maintenance Plan Wizard. AFAIU, the penultimate task "Back Up Database Task" will be executed ...
0
votes
2answers
122 views

Does ROLLBACK TRAN honor LOCK_TIMEOUT value?

I have a following stored procedure on my system. BEGIN TRY BEGIN TRAN SET LOCK_TIMEOUT 10000 UPDATE tbl COMMIT TRAN END TRY BEGIN CATCH IF @@TRANCOUNT > 0 ROLLBACK TRAN END CATCH ...
2
votes
2answers
327 views

Storing revisions in SQL Server (simply much like TFS)

So, what I've got so far: Table: ChangeSets Columns: Id | Comment | Committer Table: Customers Columns: Id | Name Table: CustomerChangeSets Columns: Id | CustomerId (FK) | ChangeSetId (FK) So ...
0
votes
5answers
2k views

Do SQL Server or MYSQL contain JSON supporting functions?

Do SQL Server or MYSQL contain JSON supporting functions? If so, then please tell me the name of the functions or where else I can find it? I am new in this stuff and I want to implement JSON with ...
1
vote
2answers
612 views

SSMS command to disconnect after query has finished

In SQL Server Management Studio, is there any way (for example a SQLCMD command or something) to get the SQL script window to automatically disconnect as soon as the query has finished executing?
1
vote
0answers
495 views

Using Mirroring to upgrade SQL Server 2008 R2 to SQL Server 2012

I am attempting to mirror a SQL Server 2008 R2 database currently in a fail over with the purpose of doing an in place upgrade. I have installed SQL Server 2012 on another machine to serve as my ...
1
vote
1answer
696 views

SQL Server 2012 - Full Text Search [Break word - Underscore]

Let's say I want to search for a list containing 'PS3': SELECT * FROM [TABLE] WHERE CONTAINS(Title, 'PS3') When the Title is proceeded by an underscore it will not return it. Oblivion-PS3 -> Good ...
0
votes
1answer
582 views

connection pooling, transactions, nested transaction and rollback

I've got strange behavior on production. First user request thru application failed, I've got SQLServerException with "Lock request time out period exceeded." After that following requests are ...
0
votes
2answers
419 views

how to create backup for update tables structures in existing DB?

I have Sql Server DB, I know I can Create thru "Generate Scripts" backup for SP and Functions then I just replace inside the script the "CREATE" with "ALTER", that will update the target DB with the ...
2
votes
2answers
11k views

Options for Data Encryption in SQL Server 2008 R2 Standard Edition?

I'm helping a friend with setting up encryption of data on SQL Server 2008 R2 Standard edition. Upon original research I thought I could use TDE but did not realize that it was only available for ...
3
votes
4answers
2k views

Sql server full text search performance with additional conditions

We have a performance problem with SQL Server (2008 R2) Full text search. When we have additional where conditions to full-text search condition, it gets too slow. Here is my simplified query: ...
1
vote
2answers
5k views

SQL Insert error Column name or number of supplied values [closed]

I have one of the stored procedures for my replication giving this error Insert Error: Column name or number of supplied value does not match table definition". The stored procedure is ...
0
votes
1answer
596 views

Easy replication for SQL Server: Can it be set up like mongodb or Oracle?

This might look like a noob question... but it isn't. (I have 18 years of SQL Server experience, and three years of MongoDB experience.) The basic scenario is: -- Data Center has big, primary SQL ...
1
vote
1answer
3k views

Can I delete SQL Server 2008 R2 “audittrace” (.trc) files

This is precaution question :) When I was configuring SQL Server 2008 R2 database engine, I checked "Enable C2 audits" which I don't really need. From that time it created a lot of files like ...
1
vote
1answer
4k views

Nested with - Incorrect syntax near the keyword 'WITH'

With inside with This is ok WITH CS AS ( SELECT 'ab' as a ) SELECT * from cs http://data.stackexchange.com/mathematics/revision/138658/170321/comment-partition-by-question ...
0
votes
1answer
1k views

AdventureWorks2012: “The FILE SIZE property is incorrect” error while trying to attach sample database “Adventure Works for SQL Server 2012”

I am trying to attach the sample databases, for example, AdventureWorks2012_Data.mdf from codeplex "Adventure Works for SQL Server 2012" into a MS SQL Server 2012 (default) instances on a a virtual ...
0
votes
1answer
129 views

Multiple filters with joins

I just read this qestion: SQL Multiple Filter - Optimal Way I tried this with Northwind. I filter like this: declare @supplier int = 1 declare @category int = 1 select * from products p WHERE ...
2
votes
0answers
169 views

How to give permissions to 90+ SQL Servers without tweaking in each of them?

There are over 90+ MS SQL Servers (SQL Server 2005, 2008 and 2012). All in the same Windows domain (but physically all over the world). How to give a domain user (administrative, or other) ...
3
votes
1answer
3k views

How can I find and clean up unused database files?

How can I find and clean up unused (i.e. not used by any attached database) SQL Server database files (.mdf, .ldf, .ndf) that take up extra space on my server?
-1
votes
1answer
152 views

How to Recover corrupt SQL Sever database? [duplicate]

I am running Windows 2000 OS and while using my SQL application a message popped-up, can anyone figure it out, the message is like that. Msg 5172, Level 16, State 15, Line 1