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

Rollback group of DDL statements

Working in SQL Server 2008 R2, I am trying to rollback a set of DDL statements as a group (think of an upgrade script for a database), but am running into trouble. Take the following code: begin try ...
5
votes
3answers
10k views

T-SQL query to report disk space allocation and used space for auto-grow SAN databases

We are using 6 databases in total for an application, and we can only share 4TB of space for all 6 databases (via SAN storage). I'd like to write a query (report) for a single database indicating the ...
1
vote
2answers
199 views

Can this SQL be made more efficient and combined into one select?

I have the 4 SQL queries below that I combine into one result set at the end. I am guessing that since I am operating on the same tables in each of the SQL sections, there is a cool way to get my ...
0
votes
1answer
718 views

How to test permissions on an empty database?

It's usual in an organization I work in that I need to request a database creation to the DBA group (I am a developer). As such, they will also create a user for me to use and a database dedicated to ...
33
votes
5answers
11k views

Why does ALTER COLUMN to NOT NULL cause massive log file growth?

I have a table with 64m rows taking 4.3 GB on disk for its data. Each row is about 30 bytes of integer columns, plus a variable NVARCHAR(255) column for text. I added a a NULLABLE column with ...
2
votes
3answers
2k views

Software tool to visualize and print DB diagrams [closed]

I have some SQL Server databases and use SQL Server Management Studio to manage them. However, I find that is not very friendly to create, design and print database diagrams (for existing tables). ...
2
votes
2answers
107 views

Workflow for SQL Server + Azure SQL development?

Lets assume the following: 5 devs all working on laptops Each develops/debugs on Azure compute emulator (code) and SQL Server (db) - both running locally on their laptops. I'd like to have ...
5
votes
3answers
3k views

How can I inspect the security settings of a SQL Server Endpoint?

I am in the process of creating a TEST environment for our SQL Server development staff. In production we have 3 SQL Servers, SQL01 contains several databases that are mirrored to SQL02. SQL03 ...
2
votes
1answer
152 views

Transaction level difference between using a large IN filter VS. “BEGIN TRAN/COMMIT”

I would like to delete about 100,000 records with minimal server overhead. I've had a few nagging questions I haven't been able to test properly so I figured I'd ask some experts here. Which would ...
1
vote
2answers
246 views

Query Linked Server Logins

I'd like to produce a listing of linked servers and their mapped logins. Anyone know how? sys.sysservers will show servers, but no login information is presented.
6
votes
1answer
511 views

Executing Powershell SMO against a cluster with elevated privileges to update service accounts

I'm working on a Powershell script to update service accounts on named SQL instances in a failover cluster. I'm trying to use the SMO and WMI to update this so that I can update the service account ...
3
votes
1answer
347 views

Renaming SQL Server Agent operator

I want to rename SQL Server Agent operator, that is change it's name. Is this a "valid" thing to do? I noticed that trying to change name in SSMS via Operator/Properties dialog doesn't actually do ...
2
votes
1answer
491 views

Clustered Index vs Primary Key Performance

I'm trying to tune a stored procedure which has a temp table used for matching (only retrieval, no updates or inserts). We're considering applying a clustered key to a temp table. We're also ...
2
votes
2answers
748 views

how to get avg() size by day using two decimal places

does this simple query result in grouping the attachments by day and giving me the total number of daily attachments as well as the average size? the only table i am querying is attachmentdetail ...
3
votes
4answers
1k views

limiting sql server backups inside .bak file

I have a job scheduled to run a few times everyday. The job backups my databases, like: BACKUP DATABASE [databasename] TO DISK = N'd:\sqlserver\backup\databasename.bak' I can track the backups in ...
3
votes
1answer
179 views

How to update views outside of update/insert transaction in SQL Server

Looking at SQL Server indexed views I see that these views are updated within a transaction that updates dependent tables. I wonder if there is a way around it? There will be about 10 views with 20 ...
3
votes
1answer
3k views

How to create a partitioned table based on date?

I'm trying to create a partitioned table where partitioning is determined by OrderDate. I'm trying to create a clustered index on OrderDate and a nonclustered primary key on OrderID. But I get an ...
5
votes
2answers
2k views

How to balance SQL Server memory with SQL Server Analysis Services memory

We have many systems that have the same configuration One Server (virtual or physical) Running SQL Server (SQL) and SQL Server Analysis Server (AS) multiple cores 16gb RAM Each night the SQL ...
0
votes
1answer
67 views

Changing column value [closed]

Normally used to MySQL so need help on syntax check. with SELECT * FROM Bit WHERE CustomerID='3512242' I have a field called Filer. I want to change it from a P to a D. Do I use UPDATE to change the ...
4
votes
2answers
170 views

Display all tables and their columns

Is there a way to display the layouts for all the tables to see their columns? I am trying to find tables with a certain column names. I am using the web app Web Data Administrator Example: table1 ...
10
votes
3answers
14k views

Can I use SQL Server Management Studio 2012 on a 2008 server?

My school is using SQL Server 2008. Last time I used it I only installed (at home) SQL Server Management Studio 2008 part, and used VPN to connect to school's server. Now I want to install SQL Server ...
4
votes
1answer
600 views

SQL Server Buffer Pool Utilization under VMWare

I recently migrated a physical SQL Server box (2012) over to ESX (5.1) simply for ease of administration. It is and will be the only guest on the server. As expected there was a marginal performance ...
4
votes
1answer
920 views

What permissions are needed to view dependencies?

My company is moving to a much more restrictive security model in the near future. As part of that we are changing specific servers to the new model and testing all our existing processes. One of ...
5
votes
1answer
283 views

How does SQL Server order results when joins are used?

How does SQL Server figure out the order of the records in the result set of query execution? I am trying to make heads or tails of it but find myself scratching my head. When I change the fields I ...
1
vote
3answers
4k views

sql server instance using maximum cpu usage

I have a SQL server 2005 instance installed on the server machine with two vm Server Specification are *Processor:* Xeon Ram : 6GB OS: window server on vm ware It is running asp.net application ...
1
vote
2answers
2k views

Import Excel Table to SQL Server - with date column

I'm trying to import a excel table that has a column with dates. My query works without the column date. I'm using ODBC to import. strCon = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & ...
3
votes
4answers
208 views

Does it make sense to use full recovery if the data and log files are on the same HD?

We have a database that was set up to use full recovery and my guess is that the reasoning was only to prevent data loss if a failure happened between backups. We make daily full backups of the ...
4
votes
1answer
487 views

SQL Server Row Count sp_spaceused rows discrepancy

I am researching a performance problem with an application running on SQL Server 2005. I've conducted performance tuning, and I realize that a key table is poorly structured(poorly chosen clustered ...
3
votes
1answer
240 views

SELECT multiple sensor values in one query

Background I have a couple of devices, each with a couple of sensors. I log these every now and then and stores them in a table described below. When someone requests a web page, I fetch a couple of ...
2
votes
1answer
6k views

SQL Server permissions to create, restore, delete only some databases

On MS SQL Server 2008 R2, I need to have user which can create, restore, DBCC CHECKDB and then drop databases. But he must not be able to access or delete specified databases on server (security ...
2
votes
2answers
97 views

Can I see the RAID group name for my SQL Server Database files?

Is it possible to see the RAID group name that my database (and log) files are sitting on, in one of the DMVs (or some other system table) ?
41
votes
4answers
6k views

Are SQL Server in-place upgrades as ill advised as they used to be?

I have been working with SQL server on and off since SQL Server 6.5, the old advice that still rings in my head was never to do an in-place upgrade. I'm currently upgrading my 2008 R2 DEV and TEST ...
5
votes
1answer
453 views

SQL Server / MySQL to DTD (+XML)

Is there any way I can at least export a table schema from MSSQL or MySQL to a DTD file? Also the same for the data of the tables to XML. I am really not getting how to write DTDs, so I badly need a ...
4
votes
2answers
2k views

SELECT/INSERT Deadlock

This instance hosts the SharePoint 2007 databases (SP). We have been experiencing numerous SELECT/INSERT deadlocks against one heavily utilized table within SP content database. I have narrowed down ...
3
votes
1answer
489 views

Will one nvarchar column affect query performance?

I have one column that I recently converted to nvarchar(100) to store Asian characters. The other columns in this table, and the other tables in the same database, use varchar, int, bit and datetime. ...
3
votes
1answer
2k views

Real Time SQL Server Analysis Services Cube Processing Report

I would like to know if there is a way to generate a report to determine which SQL Server Analysis Services cubes are processing using SQL Server Reporting Services? I would like to be able to run ...
9
votes
2answers
463 views

SQL Server Filetable document properties

I'm using SQL Server 2012's Filetable to store documents and search them with Semantic Search. I was wondering if there is a way to list all the document properties (meta data). There is a way to ...
6
votes
2answers
916 views

Options for setting NOLOCK hint in dataset queries

Some context: At first we wrote reports just "straight up", without any locking hints in the queries. With the larger reports this would sometimes cause locking problems. At first we remedied this by ...
2
votes
1answer
404 views

Understanding SQL Server encryption (by password)?

After asking this I still have a question. A company need to store sensitive data. Please let's not talk about certificate right now. A DBA does the following : CREATE SYMMETRIC KEY ...
9
votes
2answers
5k views

How To Profile Stored Procedures

I am using SQL Server 2012 and was wondering how to profile stored procedures For instance can profiler capture each individual SQL statement in a stored procedure, what it is, and how long it takes ...
4
votes
1answer
1k views

Is a clustered index locked while a (clustered index) scan is in progress?

The question is pretty simple, as the title says. However, I cannot find any references to confirm or contradict this. The problem leading me to this question is that I have a view joining several ...
4
votes
1answer
2k views

How to force the use of row locks?

I am trying to get my table to use row locks. I have already disabled lock escalation. The isolation level is READ_COMMITTED_SNAPSHOT alter table <TABLE_NAME> SET (LOCK_ESCALATION=DISABLE) go ...
3
votes
2answers
160 views

Does the Query cost in Sql Server account for buffering?

If I am comparing 2 queries by checking their relative "Query cost" as a high level indicator of performance, does the buffer status have any effect on the values shown in the execution plan?
1
vote
0answers
58 views

How To Use Publication Without Precompiled Partitions

I am using SQL 2012 with merge replication. Our setup is quite complicated and thus it seems running the publication with precompiled partitions is not going to work. The merge agent is slow to do ...
4
votes
1answer
544 views

Besides attaching the debugger, is there any other differences between “(local)\Instance” and “MyLocalName\Instance”?

When using SQL Server Management Studio for SQL Server 2008 R2 connecting to a local SQL Server 2008 R2 instance (version 10.50.2500), I know that if I am using the instance name (local)\sql2008 it ...
3
votes
0answers
93 views

How To Diagnose Slow sp_mssetupbelongs

I am using merge replication with SQL 2012. When performing a clean sync using the merge agent I am getting a timeout on this stored procedure, sp_mssetupbelongs I am wondering what the best way to ...
4
votes
1answer
881 views

Can I connect to SQL Server 2008 R2 database from SSIS 2012?

I need to redevelop an ETL process and I'm evaluating options. I'm running SQL Server 2008 R2 database, and SSIS 2008 will take too long to develop and test the required packages. I understand that ...
5
votes
2answers
292 views

Running queries against multiple servers

I want to use a Central Management Server, with a server group underneith, to run management queries against multiple server. I know how to run a query against the whole group through SSMS, but I ...
2
votes
1answer
283 views

How compatible are Sybase and SQL Server clients connecting to the alternate back end?

Given the shared history of the Sybase and SQL Server products, and their use of a similar (identical?) wire protocol in TDS, what definite statements can be made, if any, about cross compatibility. ...
4
votes
0answers
288 views

ERWIN create and use database

Im trying to generate physical database from my logical model using ERWIN 7. All is well in the script that is generated automatically, there is only the problem that the model is created in the ...