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)

2
votes
2answers
760 views

Accessing a network share via a SQL Server 2012 Availability Group

If you have a SQL Server Cluster called CLS, with machines CLS1 and CLS2, accessing: \\CLS\network\path is equivalent to accessing either \\CLS1\network\path or \\CLS2\network\path depending ...
5
votes
2answers
917 views

Bulk Data Loading and Transaction Log

im currently working on a project which bulk import data from flat files(csv) about 18 differents files each linking to a specific table through some store procedure. I followed the steps as advised ...
1
vote
0answers
152 views

SQL Server BCP imports, but table still has 0 records

I ran the following command from the command line on SQLServer 2008 R2 BCP C4L.dbo.districts in C:\TEMP\districts.sdf -f C:\TEMP\districts_import.fmt -T' No errors were reported and it ran as ...
5
votes
1answer
488 views

Recovery time effects of Availability Groups

We did different kinds of basic Tests and AlwaysOn passed in many tests. We finally did a heavy write test for AlwaysOn and it gave surprising results. The actual Test details are here, the goal is ...
2
votes
1answer
2k views

Error in restore database

I use this query in SQL Server 2008 R2 to restore DB1 database: RESTORE DATABASE [DB1] FROM DISK = N'D:\new.bak' WITH RESTRICTED_USER, FILE = 1, NOUNLOAD, REPLACE, STATS = 10; The following error ...
1
vote
0answers
27 views

database sharding - handling common/universal tables [duplicate]

Possible Duplicate: sql server database sharding - what to do with common data / non sharded data We have a very large scale enterprise level database. As part of our business model all web ...
6
votes
3answers
6k views

How can I backup a large SQL Server database without impacting performance?

We've had reports of queries running slowly or timing out early in the morning, and the only job I see running that I think could affect this is our database backup job. The database itself is about ...
8
votes
3answers
591 views

sql server database sharding - what to do with common data / non sharded data

We have a very large scale enterprise level database. As part of our business model all web users hit our web servers at the same time each month which in turn hammer our sql box. The traffic is very ...
6
votes
1answer
2k views

Timeout expired error while using copy database wizard

Microsoft made me believe that SQL Server 2012 Copy Database Wizard is the most optimal way of copying a SQL Server 2000 database to SQL Server 2012. After struggling a few hours, I was able to get ...
3
votes
3answers
654 views

How to delete large amount of data from a sql table?

We ran out of disk space and we have a table with about 10million records. We'd like to delete the old records which are about 2million. What are the impact of just deleting these using a simple ...
4
votes
2answers
2k views

How do I configure SQL Server 2012 so that it can restore and see files in my user account?

I have an SQL Server 2012 instance running as a service on my computer, and according to the service page it logs on as account "NT Service\MSSQLSERVER". However I can't see that account name ...
4
votes
1answer
1k views

SQL Server 2008 Setup Error 0x80070490

I am trying to install SQL Server 2008 x64 on Windows 2008 R2 and keep getting the following error: SQL Server Setup has encountered the following error: Element not found. (Exception from ...
17
votes
1answer
6k views

MERGE a subset of the target table

I am trying to use a MERGE statement to insert or delete rows from a table, but I only want to act on a subset of those rows. The documentation for MERGE has a pretty strongly worded warning: It ...
4
votes
1answer
323 views

Why does WAITFOR (RECEIVE FROM QUEUE) show up in the monitor incorrectly?

I kick off the following command in my app: WAITFOR (RECEIVE CONVERT(int, message_body) AS Message FROM MyQueue) When I run `sp_who2 active', I get Status=SUSPENDED and Command=DELETE Note: ...
13
votes
2answers
303 views

Does firing off an indefinite WAITFOR increase the log file size?

In the last release of my app, I added a command that tells it to wait when something arrives in the Service Broker queue: WAITFOR (RECEIVE CONVERT(int, message_body) AS Message FROM MyQueue) The ...
4
votes
1answer
111 views

Is there a compact way to use a NOT IN (1,2,3) syntax when setting a variable?

Expressions like NOT IN (1,2,3) are valid in a where clause: SELECT foo FROM bar WHERE ((record_type NOT IN (2, 3, 7, 18, 19, 20, 21,12,13,22)) However if I want to move an elaborate expression ...
1
vote
1answer
109 views

Track access to database

How can I see who has accessed the database, viewed the tables or executed SELECT, for SQL Server 2008 R2?
2
votes
3answers
3k views

How to avoid using the IN clause in sql query used in a stored procedure

Is there a better way to write the SQL other than using the IN clause in the below given SP. When i am using this IN clause, i suffer a performance dip due to large number or records involved in the ...
1
vote
2answers
186 views

Automatic create SQL database and table relationship

For SQL Server 2008, what is the best way to automatically "draw up" the Database relation ship and table relationship too? Is there any way to visualize database with this.
4
votes
1answer
1k views

How to restore replication after server crash

We had two databases on one SQL Server 2005 instance with transactional replication between them (3 tables as articles). This server acted both as publisher and distributor. Then the RAID on the ...
1
vote
1answer
1k views

Copy data between two databases periodically [duplicate]

Possible Duplicate: How to update one database from another? I need to know how to copy data across to another SQL Server database periodically. Both databases are in the same SQL server; I ...
3
votes
2answers
2k views

Procedure cache (plan cache) size

I'm developing an application with many, dinamycally-assembled, complicated SQL queries. I'd like to keep the query plans in the procedure cache for as long as it is possible. To prevent discarding ...
1
vote
2answers
200 views

XML Large DataBase is the best? [closed]

Is the best way to implement a large database is XML? Or is there a better way? 1 - reduce the time complexity 2 - Reduce the amount of traffic between the tables And other factors ... Which ...
1
vote
2answers
168 views

2012 Transactional replication not delivering new articles

I have added a new article to an existing push publication with the following code sp_addarticle @publication='statics', article='FlightBaggageMarkup_tbl',source_object='FlightBaggageMarkup_tbl' ...
3
votes
1answer
630 views

Profiler TextData output is null

I am doing a trace on a database and dumping the trace realtime into a table. The reason I'm doing a trace is I want to see all the queries that are being executed against the database. ...
5
votes
1answer
2k views

ETL: extracting from 200 tables - SSIS data flow or custom T-SQL?

Based on my analysis, a complete dimensional model for our data warehouse will require extraction from over 200 source tables. Some of these tables will be extracted as part of an incremental load and ...
11
votes
2answers
2k views

Deadlocks From Locks on Same Temporary Tables In Different Processes

I have found a deadlock that appears to show something I thought was impossible. There are two processes involved in the deadlock: 1. process8cf948 SPID 63 Performing an ALTER TABLE on temporary ...
3
votes
2answers
170 views

Select blocking issue [closed]

The database was not responding to simple select statements like select * from table I noticed in sys.dm_os_waiting_tasks that one session is blocking, blocking session was pointing to a stored ...
-1
votes
1answer
136 views

Covering Index isn't being used and I don't know why

We have this complicated query that I'm trying to make "better" until we move it to pull from a data warehouse. I need a solution that's "good enough" for now and I think I'm about 2-3 indexes away ...
0
votes
1answer
170 views

avoid insert xml duplicate data

how can to prevent duplicate inserts for every Execute? insert into IQ (XMLDT)values('<row>sdsdf</row>')
2
votes
1answer
370 views

Non-clustered Index Update not displayed in execution plan [duplicate]

Possible Duplicate: Nonclustered Index Insert I'm trying to work out the cost of having a nonclustered index on a particular table, but I don't see any maintenance cost in the execution ...
5
votes
1answer
1k views

Performance tuning a cascading delete with many foreign keys

I have a delete query that is taking a long time. Looking at the execution plan, I see that most of the estimated cost in the delete query is in a section of the data model that had a lot of data ...
4
votes
1answer
3k views

ASPState database locking and growth problems

We use an ASPState database to persist .NET Session state on a SQL Server 2005 cluster. We are seeing some strange behavior during peak periods The DeleteExpiredSessions proc is run every minute ...
14
votes
1answer
10k views

How do I attach a database in SQL Server?

Some common questions relating to attaching databases in SQL Server: What does it mean to attach or detach a database? How do I detach a database? How do I attach a database? What ...
2
votes
1answer
535 views

What does it mean if the spt_monitor - table in SQL Server is empty?

What does it mean for my environment if I find that the spt_monitor table in SQL Server is empty? What is this table, how is it used and what populates it? I am using SQL Server 2005. My ...
4
votes
1answer
364 views

Expanding a partitioned table

I have a table that holds four years of data, where for each month I have a partition that is based on a filegroup with two files. Unexpectedly, I received eight more years of data and prepared the ...
2
votes
1answer
1k views

how to convert xml to database table

input: Declare @OUT xml select @OUT = N' <row> <kind>MainCat</kind> <sortid>1</sortid> <kind_id>1</kind_id> <PPoet>حافظ</PPoet> ...
2
votes
1answer
511 views

An unknown error occurred while processing the request on the server [closed]

I have an asp.net 4.0 application with a button that opens a SSRS report. This works fine on my development machine and I can open the report directly with report manager but when I try to access the ...
0
votes
0answers
316 views

Cannot restore Amazon RDS SQL Server database to given point-in-time using SQL Server Management Studio [closed]

I'm trying to restore one of my Amazon DRS SQL Server databases. Using SQL Server Management Studio, I can correct to my DRS database instance using the master account I created when creating the ...
2
votes
5answers
7k views

Cannot start SqlLocalDB instance with my Windows account

I'm the administrator and simply run the command: sqllocaldb start v11.0 Result: Start of LocalDB instance "v11.0" failed because of the following error: Error occurred during LocalDB instance ...
4
votes
1answer
1k views

Cannot restore Amazon RDS SQL Server database to given point-in-time using SQL Server Management Studio

I'm trying to restore one of my Amazon DRS SQL Server databases. Using SQL Server Management Studio, I can correct to my DRS instance using the master account I created when creating the database ...
1
vote
0answers
140 views

SQL server Load Balancing

SQL server user access cut down from 8pm - 9am. During this period our SSIS scripts would run to load data(from Oracle/mainframe/Access) to sql, large database(s) & too much data - mortgage ...
7
votes
3answers
762 views

Performance benefit of taking unused databases offline

I have several databases for legacy applications which run in VMs that are currently off until someone needs to look at some history. I have set each of the databases used by these applications to ...
3
votes
2answers
1k views

How to prevent SQL Server service account from registering / deregistering SPN?

The service account is a domain account. It is not a domain admin (nor is it a member of any group that is a domain admin). It has neither "write servicePrincipalName" nor "Write public information" ...
1
vote
1answer
106 views

Input requested on localization setup for DB

I am building an ASP.Net site that will pull dynamic data from SQL server. The site will be built with localization/globalization foundations in anticipation that in a year or so the site will start ...
1
vote
1answer
640 views

Connect to SQL Server using OLEDB or ODBC?

We have a desktop application written in Visual Basic .NET. One our clients needs to use ODBC instead of OLEDB to connect to the SQL Server 2008 R2 Database. The company has several databases ...
4
votes
1answer
3k views

Should I rebuild index after truncate/large insert?

I have a stored procedure that truncates some tables with around 1.75M rows in each, before inserting new data (based on data in other tables, calculations etc.) Basic outline is very simple: ...
1
vote
1answer
173 views

How to store lots of small text in a SQL Server database?

I have a table with a varchar(max) column that stores text ~4-10KB in size. Data is just being added - never modified, it is a log. My problem is that a table grows too large in size - I would like to ...
11
votes
1answer
1k views

DELETE vs TRUNCATE

I am trying to get a greater understanding on the differences between the DELETE and TRUNCATE commands. My understanding of the internals goes something along the lines of: DELETE -> the database ...
3
votes
2answers
529 views

Is it possible to get schema ID in another database without using dynamic sql?

I start with an object ID and a database ID. Inside a user defined function, I want to get the full name and ID of the database, schema, and object. How can I get the schema ID without using dynamic ...