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)

12
votes
6answers
1k views

Identical(?) SQL Server 2005 machines; query takes 2sec on one, 15min on the other

The Environment: We have two 32-bit Windows Server 2003 R2 machines running SQL Server 2005. The hardware configurations are identical servers with Xeon 5160 CPU, 4GB RAM, and 13GB RAID0. AWE and ...
2
votes
1answer
1k views

SQL Server Replication causing locks on table

we have three MSSQL 2005 servers (database is set to compatibility level 80 for legacy reasons) which we have just set up Transactional Replication w/ Updateable Subscriptions on. Two which are ...
2
votes
2answers
48 views

SQL Server 2000 - Is this table needed?

SQL Server 2000 I've been tasked with cleaning up an SQL database of which I have no history working with so I'm not familiar with the tables within. Short from dropping a table and seeing if anyone ...
3
votes
1answer
8k views

SQL Server Agent Job Step “Run As” dropdown

When creating a job step in SQL Server 2008 R2 Agent, the third dropdown in the General page is "Run as:" - but this is empty, and seems to always be empty! What is it for? Thanks
5
votes
3answers
765 views

Does SQL server optimize or pre-parse stored procedures?

Despite what DBAs will tell you ("use stored procedures because the server will optimize them thus they are faster than ad-hoc queries"), I have heard that SQL server does not actually optimize stored ...
4
votes
2answers
1k views

Two relationships to same table

i have one transaction table, each transaction has 5-6 contacts involved. each contact has the same fields like name, address, cell, email etc. So the best thing I guess is to use the same contact ...
3
votes
2answers
228 views

How to know dependency on a table

I have a Database Called Total and I have about 40 tables in it.I am trying to move the tables in the database into a different server So I have prepared all the create table scripts but the problem ...
8
votes
2answers
9k views

Difference Between Row Level and Page Level Locking and Consequences

When attempting to run my Maintenance Plan, I receive the following error: Executing the query "" failed with the following error: "The index "" (partition 1) on table "" cannot be reorganized ...
3
votes
3answers
1k views

Trigger shouldn't block insert

I have a trigger on insert but if the trigger fails the insert fails too. is there a way to let the insert proceed even if the trigger fails? EDIT: I use a trigger to send a email when a new record ...
7
votes
2answers
591 views

Code creates different plan when ran ad-hoc vs. in a stored procedure

I have a delete statement that is using a bad plan when run inside a stored procedure, but is choosing a much better plan when run ad-hoc. I have rebuilt all the indexes for the tables used by the ...
0
votes
2answers
3k views

Hide column if any value is null or zero via proc sql or view [closed]

Given either of the two following datasets Kağıt Cinsi Sarı Yeşil Mavi Kalın 4 0 5 İnce null 0 3 or Kağıt Cinsi ...
2
votes
4answers
2k views

What impact do indexes have on the performance of table modifications? [duplicate]

I have always wondered what the effect indexes have on table modification in SQL Server. Will modification of a table will be slower with an increased number of indexes applied to that table? My gut ...
2
votes
1answer
205 views

stored procedure times out while subsequent runs take 1/6 the time

So I have this stored procedure which is running very slow (and timing out) in one particular production environment. This stored procedure produces an xml of profile data. In all other ...
3
votes
1answer
158 views

How to get SQL Server Profiler to show amended tables

The ASP.Net application I'm maintaining at the moment has a lot of activity in the database when ever a postback occurs. For the example I'm currently looking at, Profiler shows a mass of activity ...
8
votes
7answers
845 views

Scheduled backup task doesn't always backup all databases despite always saying job successful

I have a job in SQL 2008 that runs a stored proc to backup all databases. This runs daily via sql server agent job. It quits with success every day but some days it quits with success only after ...
6
votes
6answers
6k views

CXPACKET Waits performance tune for SQL Server 2008

I have a SQL Server 2008 query that is working on millions of records. The query is w/in a proc that is run nightly by a job. The query can take a full day to run when I first put it on the server, ...
4
votes
1answer
209 views

Is there some drawback to define SPARSE columns?

I have a table which has a lot of NULL values in columns. But some columns don't contain NULLs at all (although nullable). Is there some drawback to declare all of these columns as SPARSE?
1
vote
0answers
314 views

Regular Expression with UPDATE and SELECT [closed]

Want to use regular expression to execute UPDATE and SELECT query. I want to make regular expression to detect injection attack crack Please suggest.
1
vote
1answer
297 views

Running a sql server Trace of 1 GB using sqlcmd

I am load testing two sql server instances. I have a trace file from sql server 2000 database with a file size of little less than 1 GB. I am running this using the sqlcmd utility and it is been ...
10
votes
2answers
7k views

What is a heterogeneous query?

I got the following error message regarding a SQL query I'm running in a program. SQL Server 2005 T-SQL. Heterogeneous queries require the ANSI_NULLS and ANSI_WARNINGS options to be set for the ...
5
votes
2answers
2k views

How do I clear a table from SQL Server's cache?

I have a few tables in my database that should not be cached. How do I tell SQL Server not to cache a table's pages or how do I flush a single table from the cache? Flushing all the cache is not an ...
1
vote
2answers
14k views

How to get table columns with datatypes (and lengths) using PowerShell?

I'm trying to get column names with data types (and lengths) for SQL Server instance using PowerShell. I got this far: #Load PSSnapin Add-PSSnapin *SQL* #Get column names $colNames = dir ...
4
votes
1answer
76 views

Internals of Windows-to-Windows SQL Server data transfer

This is a sort of generic question and I don't require a very specific answer, but let me ask it by describing a scenario. You connect to a remote db in SQL Server Studio 08, and run a select * ...
4
votes
1answer
239 views

SQL Server transactional replication - behaviour of a MERGE command on the subscriber(s) vs. publisher

Background I have two instances of SQL server running on two different machines: One is a publisher, the other is a subscriber for a single (large) database. The replication type is transactional. ...
3
votes
3answers
351 views

Same tables with same data, different SQL Server stored procedure performance

I have 2 SQL Server 2008 instances installed on the same server. They have same table structures with same data. I have a stored procedure deployed on both of them. The stored procedure performs ...
13
votes
3answers
8k views

Is it possible to restore sql-server bak and shrink the log at the same time?

We have a bak file from a client that we have transferred to our developer offices for problem investigation. The backup is currently 25GB and the restored database is about the same size however it ...
8
votes
4answers
4k views

Parallelism Best Practices

What are the best practices with setting parallelism in general? I know that SQL Server defaults to 0 to use all available processors, but in what instance would you want to change this default ...
2
votes
2answers
2k views

Query data from multiple linked remote databases

Using SQL Server 2005 databases and SQL Server Management Studio 2008, I need to query a single value from each of n linked databases at a regular interval. The servers are physically remote and I can ...
5
votes
2answers
72 views

Using stored procedures

I have a task which receives an input and performs a series of tasks on the SQL server, which some depend on the content of the server and on the input. For that I use a lot of selects and then logic ...
3
votes
1answer
1k views

SQL 2000 Maintenance Scripts

Hi I've stumbled into the administration of a Legacy SQL 2000 server that has had next to no maintenance for the past 8 years (and is very slow). As I have only been doing DBA / PT for the past 2 ...
8
votes
6answers
3k views

How do you submit a List of items to a Stored Procedure to limit results? [duplicate]

Possible Duplicate: Passing array parameters to a stored procedure Lets say you want to filter results by a List of uniqueidentifiers such that your SQL statement would read: WHERE ...
8
votes
2answers
2k views

How does using separate schemas affect SQL Server 2008 performance?

I want to use separate schemas for objects with different purposes in our SQL Server 2008 database. Right now we use a fairly mind-numbing naming convention to indicate the purpose of a table or ...
9
votes
3answers
1k views

SQL Server 2008/R2 recovery model

Pretty much all of our databases on certain servers do not require the Full Recovery model (we don't do transaction log backups) and the default should always be to create databases and specify the ...
3
votes
3answers
284 views

How to send+update on duplicate a big time series to SQL server

I use a SQL Server 2008 I would like to send (and update on duplicate datetime index) a big time series (more than 1000 datapoints and eventually much more than that). What is the best way to do so? I ...
4
votes
2answers
699 views

Add constraint to ensure flag column is <= sum of column in other table

I have a column RSEFlag that contains a flag value that is the sum of one or more of 1, 2, 4. I have separate table that contains the description of each of those flag values: RSECode RSEDescription ...
6
votes
1answer
857 views

Mirroring problems after removing domain

I successfully created a mirror with certificates between two servers. One of those servers was a domain controller. After removing the domain the mirror was interrupted. After hours of searching I ...
1
vote
1answer
79 views

Can the replicated database be the publisher with SQL Server

I need to setup replication for a Client but their production database server doesn't seem to have the components installed to enable publishing. Is it possible to setup what should be the subscriber ...
4
votes
3answers
3k views

How to test if a column definition allows nulls?

I have a table with roughly 3000 rows in it and I need to modify a column definition to allow nulls. I have a change script that will perform the change but I would like to be able to re-run the ...
7
votes
4answers
826 views

DDL contention on TempDB

I have a SQL Server 2005 Standard x64 that is experiencing issues with TempDB DDL contention for the past few months. The server will experiencing contention on wait resource 2:1:103 (the wait type ...
3
votes
1answer
3k views

How to check if subscriber replication initialization has timed out

I've added merge replication to a SQL Server 2005 database and have added a SQL Server 2000 subscriber. Creation of the publisher, subscriber and snapshot creation went fine, but there seems to be a ...
1
vote
2answers
542 views

Designing a database tables for the following scenario

I just got following entities Employee, Client and Company. Where Employee and Client have one to many relationship with Company ie A single employee may be mapped to attend to many companies and ...
0
votes
1answer
126 views

SQL Server Data types and operators clarification needed

I would like to confirm the following with respect to the basic SQL Queries: The float and real data types cannot be used with the equals and not equals operator in sql. If so then what else ...
7
votes
2answers
16k views

IntelliSense not working but it is enabled

This problem is really proving to be a tricky one (and quite annoying). In SQL Server Management Studio 2008, up until a few days ago my IntelliSense was working great. Then all of a sudden it ...
2
votes
5answers
2k views

What determines the default schema name in SQL Server?

when I tried to create a table, it is using my ID as the schema name. But when the table is created on my manager's computer, the schema name is "dbo". Why? He might have administrator rights. When I ...
3
votes
2answers
940 views

How can I create a notification method when someone adds a user/login to have ‘sa’ access?

How can I create a notification method when someone adds a user/login to have ‘sa’ access on SQL Server 2005/2008/2008R2? Thanks for your help.
8
votes
6answers
419 views

Backing up SQL DB more frequently

I currently have a scheduled task that fires off each night at 2 AM that calls SQLCMD.exe and passes it a .sql script to run for the backup (shown below). We're a pretty small company with growing ...
2
votes
1answer
4k views

How do I backup SQL Server Agent configuration?

I've tried googling for this. The problem is that the all the results are about using SQL Server Agent to schedule automatic backups. How do I backup the SQL Server Agent configuration itself? If ...
2
votes
1answer
84 views

Bad Windows Authentication sign on

I do not have install privileges on my machine. Another user who has admin privileges installed it, but told the system to use Windows Authentication for the sign on. Is there a way they can change ...
10
votes
3answers
2k views

Snapshot Replication Retention

I've got Snapshot replication set up on my SQL Server 2008 production server, and I just noticed that there are snapshots ranging back to a year ago in the snapshot folder. How can I change the ...
1
vote
1answer
2k views

Recreate MSDB for SQL Server Express 2008

My SQL Server Express database's msdb file has become 'suspect'. All the other mdf files seem to be OK. I now need to recreate the msdb file, but I do not have a backup for it (guilty as charged!). ...