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
0answers
160 views

Multi-Table Join to Single Destination

I am having a serious performance issue with join together four tables and placing the results (in a certain permutation) into one destination table. I am using MSSQL 2008 and good ole T-SQL. To ...
4
votes
1answer
101 views

How can I copy specific tables into one SQL Server Table into a separate table automatically?

I'm not sure if this is possible. Looking for some help with a specific issue. I am building an iPhone application with a data layer written in Ruby that will connect to SQL Server 2008. For various ...
2
votes
2answers
1k views

SQL Server 2012 CPU core usage

Having some trouble figuring out how to alter the core usage on SQL Server 2012 Enterprise. On a server with 16 cores, is there any way to alter which ones will actively use the SQL database, and not ...
2
votes
1answer
862 views

In Change Data Capture (CDC), how to configure retention with success?

We have CDC enabled on SQL Server 2008 with retention re-configured to a number other than the default 3 days (or something similar). When we first configured it (with default options), it worked ...
7
votes
1answer
941 views

What factors go into an Indexed View's Clustered Index being selected?

Breifly What factors go into they query optimizer's selection of an indexed view's index? For me, indexed views seem to defy what I understand about how the Optimizer picks indexes. I've seen this ...
0
votes
2answers
198 views

Regarding create index and lock word in SQL statement used for SQL Server

This way someone creates an index. CREATE TABLE [dbo].[QueueSlow]( [QueueID] [int] IDENTITY(1,1) NOT NULL, [QueueDateTime] [datetime] NOT NULL, [Title] [nvarchar](255) NOT NULL, [Status] [int] NOT ...
5
votes
3answers
224 views

How do I find I.O. statistics (by index) for queries in progress

By running SET STATISTICS IO ON before running a SQL query, I can get an idea of the number of logical reads performed on each index after the query completes. By looking at the view ...
2
votes
2answers
644 views

Creating CDC system table on SQL Server 2008

I am facing problem with CDC tables in my database. I think few of these tables are damaged and are not capturing any audit information. I tried to disable CDC on these tables, but that did not work ...
2
votes
2answers
562 views

What is the Maximum Merge Articles in Merge Replication [duplicate]

Possible Duplicate: Hard limitation for merge replication article count? I am using merge replication in SQL 2012. I am looking here: Maximum Capacity Specifications for SQL Server (2012) ...
2
votes
3answers
235 views

Transaction Log file .ldf is too small

Current database is almost 200GB however the transaction log file is only 4.1GB. I am worried if this influences the performance of databse and how could it be solved. When I do this query DECLARE ...
7
votes
1answer
1k views

What's a good SQL Server backup schedule?

There seems to be a plethora of information regarding the process of setting up backup tasks, but not much information about the big-picture view of database backups. At least, it's hard to formulate ...
5
votes
2answers
564 views

How to determine which SQL Server user or database overuses server resources

I have a Microsoft SQL Server instance on my server with more than 100 databases and users. Sometimes, the SQL Server process use 100% of server CPU and I want to know which query/user/database is ...
4
votes
1answer
62 views

Restricting mail sending from SQL Server 2008

On a remote database server, hosting databases from a number of different clients, how do I ensure that someone does not send emails using my profile?
0
votes
1answer
663 views

Getting “Cannot open user default database. Login failed.” for connections that don't specify a default database

I have two virtual machines. Server A is running SQL Server 2000. Server B is running SQL Server 2008R2. I am using the same domain user to log in to both boxes. But I cannot log in to SQL Server ...
2
votes
1answer
921 views

How can I cancel index creation in SQL Server

How can I cancel an index creation? It is still running and will run for a long time, because by accident I have created a clustered index; and non clustered indices are recreating on a really huge ...
3
votes
1answer
1k views

How can I create a dblink from Postgresql 8.3 to SQL Server (2000 and 2008)?

I have a Postgresql database that need to read data from two SQL Servers (one SQL Server 2000 and one SQL Server 2008). I want to setup two dblinks to the SQL Servers. After googling, foruming, ...
0
votes
1answer
73 views

Backup audit database

We currently have SQL Server 2000 in use. One is LIVE and one is BACKUP. We have an audit database which grows massively. What would be ideal is that at the end of each month, the data gets copied ...
1
vote
1answer
103 views

SQL Server Schema Security

I have a user U in a database where I want it to be able to create types and stored procs in a specified schema say UserSchema but not be able to alter schema dbo. So I created the schema and also ...
0
votes
2answers
131 views

Print variable of same datatype

I am looking for to print two variables of same datatype I have something like this declare @one int ,@two int set @one=1 set @two=2 print @one+@two obviously it will give a result 3 but I need ...
2
votes
2answers
821 views

SQL Server 2008 R2: Restore latest backup to new database from script

We have a database for each major version of our system, for each customer, for both development and test. Like so: WHATEVER44_CUSTOMERA_DEV WHATEVER44_CUSTOMERA_TEST WHATEVER44_CUSTOMERB_DEV ...
3
votes
2answers
9k views

SQL query to return a column per date in date range?

Let me explain what I've got and what I'm trying to achieve. Let's say I have Table A: BookingsPerPerson Person_Id ArrivalDate DepartureDate 123456 2012-01-01 2012-01-04 213415 ...
4
votes
2answers
451 views

Enumerate drives available to SQL Server

I'm trying to work out a way of listing the drives that a particular instance of SQL Server is "aware" of, and understand the process. I can run EXEC master..xp_fixeddrives which gives me a list of ...
1
vote
0answers
226 views

SQL Server Browser keeps stopping on the server [closed]

I've built and installed a SQL database and client application. It all works well generally, but intermitently (normally first thing each morning), the client application reports an Error 26 - error ...
0
votes
2answers
88 views

Grouping data checking against top values

I've got data in this form: CallNum Value Accepted -------------------------------------- 971374 81.482204444473609 True 971374 83.783551111089764 False 971374 97.936875555547886 ...
4
votes
1answer
375 views

sqlcmd: no rows affected

When I run exec dbo.subprogram from SQL Server Management Studio, it executes and returns result as many rows affected. But when I run from cmd C:\Users\mssadmin>sqlcmd -S servername -d ...
1
vote
2answers
687 views

How to check if there is partitions in use in fact tables?

I'm going to take a first look of a large data warehouse with many fact tables. How can I easily check if there is partitions and partition functions in use in these fact tables?
4
votes
1answer
332 views

Raising an error with a system message_id in SQLCLR

If call CREATE DATABASE foo twice I get the error message: Msg 1801, Level 16, State 3, Line 1 Database 'dropme' already exists. Choose a different database name. The error message is listed in ...
2
votes
5answers
3k views

Combine Table Hints INDEX and FORCESEEK with Two Joins Not On PK

See first query below. Can NOT combine table hint Index and forceseek with two joins and the joins are not on the PK. How to make the first query compile? Interesting - if just one join or the other ...
7
votes
3answers
3k views

SQL Server 2008 datetime index performance bug

We are using SQL Server 2008 R2, and have a very large (100M+ rows) table with a primary id index, and a datetime column with a nonclustered index. We are seeing some highly unusual client/server ...
3
votes
1answer
2k views

Unknown database corruption: Data error in cyclic redundancy check

I have a server that is throwing an error message when I try to backup a database. The error is: 10 percent processed. 20 percent processed. Msg 3271, Level 16, State 1, Line 1 A nonrecoverable I/O ...
2
votes
1answer
84 views

How can I deny a user the ability to Alter DB files and options but still allow schema and data modifications?

I'm establishing a shared development instance for multiple single-database applications. I'm envisioning granting authorized users permissions to allow any schema and data modifications they need to ...
1
vote
4answers
5k views

Taking a backup of a single table in the SQL Server

I know how to take a backup of a database in SQL Server and restore it. But how can I take a backup of a single table, and then restore it? Is it possible? I have a database with two different names ...
3
votes
2answers
1k views

Select query according to date

We have a table to store the Events. Table has got a schema like EventID INT Primary Key EventName NVARCHAR(100) StartDate Datetime EndDate Datetime So in the front end we want to show the events ...
5
votes
2answers
552 views

How do I tell what is filling up the transaction log?

We have a transaction log on a sql database and for some reason it has filled up to 50GB when our live system only has about 2GB. Is there any way I can profile sql or the transaction log to try and ...
4
votes
1answer
103 views

Multiple Merge Replications on same SQL Server Database Conflicts

I have 2 separate merge replications on the same database on a server, one named 'POC' with a single subscriber running continuously, and another named 'Clubs' with ~50 subscribers. As of recently, ...
3
votes
2answers
659 views

Scripting a Backup Process and Backup File Ownership

Background I'm writing a Powershell script to Backup a database to a file on disk Compress and encrypt the file (7-Zip/AES256) Copy the encrypted backup to Amazon S3 Delete the backup file The ...
-1
votes
0answers
340 views

Synchronising SQL tables in two locations [closed]

We have a bit of a conundrum at the moment. ANSI SQL solutions please. We have two databases located at two different geographic locations and will be using the web for all traffic between the two ...
4
votes
2answers
320 views

Schema blocking in READ_COMMITTED_SNAPSHOT

I am trying to troubleshoot locking behavior and the READ_COMMITTED_SNAPSHOT isolation level while attempting to resolve concurrency issues. Background: Assume an online ordering system (ecommerce). ...
2
votes
2answers
525 views

SQL Server WMI Event Alert and BROKER_TASK_STOP waits

In SQL Server 2008 I created a Sql Server Agent Alert last week to monitor deadlock events. The Alert calls a job with no schedule sending the xml deadlock graph token obtained through WMI SELECT * ...
1
vote
1answer
938 views

Differences between SQL Server 2005 and SQL Server 2008 deadlock handling

We recently upgraded a server to SQL Server 2008 R2. The server had been running SQL Server 2005. We are using Transactional Replication Management Data Warehouse and Data Collector on the ...
3
votes
2answers
817 views

Set SA to weak Password in SQL Server 2012

Hi I'm migrating a database to SQL Server 2012, and I have a problem. Let me start by saying the application (ISV) has horrible security! So try not to cringe too much. The app logs in with sa ...
5
votes
3answers
2k views

SQL Server virtual log size

I'm somewhat of an accidental DBA, being a developer who inherited a couple of database servers (2005 and 2008) from someone who knew little about database administration, and seemingly had even less ...
4
votes
1answer
3k views

Deny access to information schema in SQL Server

I am looking for the best way to disable access to the sys.tables / Information Schema for a user / group in SQL Server. I found this thread from 2008 It shows a way how to deny access on ...
3
votes
2answers
131 views

index maintenance strategy if few insertion points relative to # of rows

In SQL Server 2008 R2, I have a nonclustered covering index on multiple tables with 100M+ rows. The table has a few thousand "insertion points" where all new inserts happen. This means that regardless ...
4
votes
2answers
644 views

Why index REBUILD does not reduce index fragmentatation with a page count > 1000?

This is kind of a followup to the existing question on this site "Why index REBUILD does not reduce index fragmentatation?". The accepted answer to that question, and all other resources I have found ...
2
votes
1answer
2k views

To use or not use ISNULL(NULLIF(Field1, ''))?

In the past I've seen use of something such as SELECT ISNULL(NULLIF(Field1, ''), 'NewValue') to tersely get a fallback value. However, since the advent of CASE in TSQL, we've favored something ...
10
votes
3answers
3k views

SQL Server database synchronization

Problem definition Our users need the ability to query a database that is mostly up to date. The data can be stale up to 24 hours and that is acceptable. What would be the lowest cost approach to ...
0
votes
1answer
181 views

Trouble in Multi-Language DB

I'm working on a DB design for medicines in many countries with different languages. I created a table for the different languages I want and link it to another table of chemicals. But I find that ...
0
votes
2answers
129 views

Finding changes for table-valued function definition on SQL Server

I had a Table-Valued Function in SQL Server and someone from my colleagues has altered it unexpectedly. How can I restore previous version easily? Is there any way to find the previous version?
0
votes
3answers
981 views

Best table schema to store daily hits for many items?

In my Sql Server 2005 database, I'm considering two ways of creating a table to track daily views on 100,000 items: Option 1) Each day would insert a new row for each item. So the table columns would ...