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
3answers
1k views

SQL Server : Execute as multiple users simultaneously?

I need to query a proprietary database where the software vendor has set tight permissions on each schema (one username per schema), and each schema-user is only allowed to read from their own schema. ...
1
vote
1answer
551 views

Get statistics of open connection to linked servers

How can I get information about connections from my MS SQL 2008 server to linked servers (actually it's an Oracle db)? Things like number of currently open connections, and history of opened and ...
0
votes
1answer
258 views

Thwarting some awful parameter sniffing

I've got this fairly simple reporting procedure that searches through inventory transaction data (stuff being received, moving around the warehouse, etc). The whole thing is listed below - I've only ...
3
votes
1answer
738 views

How can I execute multiple DDL statements within a transaction in Oracle?

Is it possible to execute multiple DDL statements under a single transaction with Oracle database (10g etc.?) What I'm trying to accomplish is some sort of "upgrade" functionality of the database ...
2
votes
3answers
3k views

How can I set up SQL Server 2008 users without Windows/Domain accounts?

I'm trying to do this through the SQL Server Management Studio GUI. The user accounts will be accessed by applications directly, so I don't want to create Windows user accounts. I'd rather use ...
2
votes
1answer
931 views

tempdb on raid1 isolated or raid10 shared with high write db

PROPOSAL 2 8x600gb raid 10 mdf array 4x600gb raid 10 ldf array PROPOSAL 3 8x600gb raid 10 mdf array 2x600gb raid 1 ldf array 2x600gb raid 1 tempdb mdf/ldf array READ/WRITE STATS ON ...
4
votes
6answers
1k views

Does SQL Server execute queries in parallel?

Does SQL Server execute queries in parallel? In other words, if I run a heavy query that takes 10 seconds to execute, and at the same time start another heavy query that takes 10 seconds, will the ...
18
votes
5answers
6k views

SQL: What is slowing down INSERTs if not CPU or IO?

We have a database for a product that is write-heavy. We just bought a new server machine with a SSD to help. To our surprise, the insertions were not faster than on our old machine with much slower ...
2
votes
2answers
273 views

Can I query a copy of a database without impacting performance of the primary?

I am working with a partner who has a large (150,000,000 records and growing) MSSQL database. They query and populate the database with proprietary software which I cannot easily influence. I would ...
2
votes
1answer
310 views

SSAS Dimension Help - Finding Values Not In the Dimension using Role Playing

I have a Fact / Fact Less table that has a list of Products likley to be purchased by client. Client ID Product ID 1 1 1 2 2 2 2 5 etc... I need to to allow ...
2
votes
1answer
841 views

Index physical stats DMV - Object ID/table not found

I have installed SQL Server 2012 RC0 on my laptop recently and I was trying a demo which illustrates how shrink database will cause fragmentation. I created a table, a clustered index on the identity ...
8
votes
3answers
556 views

Would it be considered as a bad practice to have multiple nullable FKs on a table in SQL Server

On my database structure in SQL Server, I have 3 types of products which requires different information about the order. So, I created one Customers table and three different orders tables: ...
1
vote
1answer
273 views

Sending SQL Server query as CSV via e-mail

Currently I'm using SSIS w/ a hacky solution to get around it not supporting auth on SMTP servers. Is there a better way I can save a query to a CSV file, then mail it as an attachment? Thanks
3
votes
1answer
63 views

Do SQL Server disabled databases cause any usage concerns?

I have a SaaS e-commerce app. When clients stop using the service I disable their SQL Server Database and User Account rather than delete them. Do these disabled databases cause any concerns related ...
4
votes
2answers
235 views

Can I be notified of a rollback in my DDL Trigger?

I'd like DDL changes in SQL Server to trigger an external process (outside of SQL). The problem is, is there a way for me to be notified via my trigger that a rollback occurred? For instance, with ...
24
votes
1answer
6k views

Why is using a table variable more than twice as fast as a #temp table in this specific case?

I was looking at the article here Temporary Tables vs. Table Variables and Their Effect on SQL Server Performance and on SQL Server 2008 was able to reproduce similar results to those shown there for ...
8
votes
3answers
2k views

Insert if not exists, concurrently

I am having concurrency issues with my inserts in a stored procedure. The relevant part of the procedure is this: select @_id = Id from table1 where othervalue = @_othervalue IF( @_id IS NULL) BEGIN ...
0
votes
3answers
139 views

What should I use as a primary key/index for a table with no unique columns that are mostly written to?

I have a table on a SQL server database that stores logging information about various user activity. Date/time, user id, and a few columns that specify where and what was done. None of this data is ...
1
vote
2answers
168 views

Execution Plans Query

I want to check the estimated number of rows of a query in MS SQL Server. I can right click on the query and select "display estimated execution plan". but I want to do the exact thing with a hard ...
3
votes
2answers
935 views

Shrink Log File without breaking Log Chain

What is the best way to shrink a log file without breaking the log chain? I realize you can do something like: alter database yourDb set recovery simple go dbcc shrinkfile(LogFileName, 0) go alter ...
3
votes
3answers
1k views

Is it good idea to change Simple Recover Model into Bulk-Logged on ETL system?

We are having an ETL process which inserts lots of data into tables. This database is set to Simple Recovery Model and the transaction log is growing a lot. I was thinking that would it help to set ...
2
votes
1answer
771 views

Sql Server 2005 - sqlcmd with output to shell and file

I do some command line batch (.bat) with sqlcmd as this way: sqlcmd -i Scripts\STEP01.sql -o PROCESS.log -S MYSERVER -E -d MYDATABASE and i need an output file (it's works currently) and also the ...
2
votes
2answers
69 views

Best index for this scenario

There is a table in our database tblCustomText( ParentID int NOT NULL, CustomFieldID int NOT NULL, Value char(50) NOT NULL, Log_CreateDate datetime NOT NULL ) (ParentID+CustomFieldID) is ...
2
votes
3answers
3k views

After I replaced master mdf/ldf files, can no longer log in

Today I couldn't start SQL Server process anymore. Reason: The log scan number (213:18:1) passed to log scan in database 'master' is not valid. This error may indicate data corruption or that the ...
0
votes
1answer
759 views

How to manage a large SQL Server database: transaction log, reduce size, alter table

Hello I have some confusion on how to manage a large SQL Server database. Let's say size is 15GB, with 3GB available, in simple recovery mode. Server is not managed by me, I cannot change the size, ...
1
vote
2answers
4k views

Why can't I connect to SQL Server 2008?

I initially installed SQL Server 2008 R2 with Windows authentication mode and have successfully changed it to mixed mode (per http://msdn.microsoft.com/en-us/library/ms188670.aspx). After this I am ...
3
votes
2answers
5k views

How to monitor SQL Server data and log file growth?

I'm trying to find a way to monitor data and log file size from SQL Server databases (within an SQL Server instance). I would not want to use third party tools, but simply pure SQL or PowerShell. I ...
6
votes
1answer
2k views

SQL 2008 R2 - Odd timeout issues

I'm having some recent timeout issues in our SQL 2008 R2 server. This started occurring late last week and has since somewhat improved. Issues: When using SSMS and right clicking over a ...
1
vote
3answers
2k views

How do I automatically deliver the SQL Server built in reports?

When you right click on a number of items in the object explorer, it gives you the option for a reports menu. Various reports may exist depending on which type of item is selected. Yet, there does not ...
2
votes
2answers
201 views

Space Consumption for SQL Index Rebuild

I am attempting to rebuild the indexes for a single table on a SQL Server 2005 reporting database. The indexes are heavily fragmented as this has not been done for a long time. I am running the ...
3
votes
2answers
951 views

What is the undo pass that SQL Server does during a RESTORE WITH STANDBY operation?

It's my understanding that SQL Server generates undo files when applying a restore to a database using the RESTORE WITH STANDBY. From the MSDN documentation (Emphasis mine): The standby file is ...
5
votes
2answers
457 views

SQL Server - DBO without Backup

Similar to my previous Question : Prevent Non Copy Only Backups, how do I create a user that can do everything to my database take backups at all. I've granted them every role except ...
6
votes
2answers
5k views

What Problems Does an Eager Spool Indicate

Currently running on SQL Server 2008 R2 I am attempting to increase performance of an UPDATE statement. I notice an Eager Spool operation in the showplan popping up. My understanding of spooling ...
1
vote
1answer
340 views

Same restore file (.bak), huge difference of execution duration time on various computers

First of all, the question is nothing to do with SQL performance optimization. I have a .BAK SQL Server backup, and have restored it on my computer. My computer: i7 2600 3.4GHz, 240GB SSD, 8GB RAM, ...
2
votes
2answers
825 views

What effect does serializable isolation level have on DDL-statements?

I'm using Red Gate SQL Compare to create a release script based on differences between SVN and a database. This results in a script containing a bunch of table- and procedure-changes and it works ...
1
vote
1answer
96 views

Trying to figure out when a table was dropped? [duplicate]

Possible Duplicate: Determining how a schema change occurred? Using SQLServer 2008, I see in my schema a particular table was dropped. I am trying to figure out when / why etc? Is there ...
4
votes
3answers
4k views

SQL Server Collation for Arabic, Hebrew, English and French

I have new SQL Server database which need to have support in 3 different languages. What character sets and collations do I need to choose if I want my database to support the following: Hebrew ...
4
votes
2answers
4k views

How to check when statistics was last executed?

We've been having a number of issues with our indexes lately which our DBA team has attributed to statistics not having been run recently. This has made me wonder - how can I check if statistics have ...
6
votes
1answer
2k views

Is there a more helpful way to detect lock acquire/release stats in SQL Profiler?

Got a few deadlocks happening on our live server, i know, it sucks right. Anyway, i'm trying to figure out how to see what SQL code is causing the locks (or holding it for too long). I've added all ...
0
votes
2answers
191 views

“Undo” some transactions from backups

Let's suppose that we are planning to execute a "risky action" on a database. Naturally we've tested on non-production databases and everything seems to be fine. We backup the database. Then we ...
-1
votes
3answers
188 views

SQL Server - Transaction Slowness

Using: SQL Server 2008 R2 I'm seeing some behavior right now in SQL Server, and I can't decide if the server is underperforming or not. I've set up a test to insert an integer into a table, as ...
64
votes
8answers
37k views

What's the difference between a CTE and a Temp Table?

What is the difference between a Common Table Expression (CTE) and a temp table? And when should I use one over the other? CTE WITH cte (Column1, Column2, Column3) AS ( SELECT Column1, Column2, ...
2
votes
0answers
87 views

Permon counters on SQL 2005 mirroring (user defined counter log file is empty) [closed]

I've been attempting to gather performance counters for mirroring using perfmon, over a period of time and saving this to a log file. I am able to do this without problem for general SQL Server ...
1
vote
1answer
103 views

backing up selected tables in a database

We need to transport database backups over a lower bandwidth connection. We only want the data of specific tables, not the whole database. In SQL Server 2008 R2, how can this be done? I am attempting ...
4
votes
3answers
3k views

How do I use `sys.dm_exec_connections` in combination with SUSER_SNAME()?

How do I use sys.dm_exec_connections in combination with SUSER_SNAME()? I want to see the username corresponding to each record in sys.dm_exec_connections.
2
votes
2answers
325 views

Scheduling a task that happens very frequently in Sql Server

I've just added some caching to my Sql server to speed up a particularly important SELECT query. This cache will be refreshed every ~10 minutes. The time between activations does not have to be ...
3
votes
2answers
2k views

Maintaining or Re-Gaining access after SQL Server database restore without SYSADMIN rights?

I am struggling with maintaining or re-gaining access after restoring an SQL Server database (2008 R2, if that makes any difference). Here is what I am trying: SQLServer login APPUSER is member of ...
2
votes
1answer
1k views

Access SQL Server from a different subnet

I'm creating a program which accesses MS SQL Server 2008, the problem is that I can run the program smoothly as an administrator account, even on different subnet computers and using terminal service ...
4
votes
2answers
4k views

sql 2008, select from a view as a different user, like owner

In sql server 2008, the system views sys.database_role_members and sys.database_principals, only returns the users and group that the current account is allowed to view. I need to check id a certain ...
3
votes
2answers
1k views

Installed SQL Server 2000 with wrong collation.. how to correct for entire server instance?

I installed SQL 2000 Developer (yes, old, don't ask) on my laptop ... with the wrong collation. Oops! It's showing Latin1_General_CI_AS, but it turns out I need to use SQL_Latin1_General_CP1_CI_AS ...