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
1answer
206 views

SQL Server : KEY lock prevents FK on nearby row, but not SELECT [closed]

I have the following table structure (simplified, pseudocode): TABLE dbo.Users (Id int NOT NULL IDENTITY PRIMARY KEY) TABLE dbo.Transfers ( Id int NOT NULL IDENTITY PRIMARY KEY, ...
4
votes
1answer
140 views

I was interrupted while transferring a very large table. How can I pick it up from where it stopped?

I wrote a python script to select and insert rows between tables in different databases (from SQL Server to Postgres). the table has around 2000000000 rows and the transfer stopped somewhere in the ...
3
votes
1answer
364 views

Send data from SQL to a serial port or IP address

I've been asked to integrate SQL transaction data with a video monitoring system in real-time. The video system's application is only capable of receiving data by listening on a serial port or a ...
2
votes
2answers
64 views

What happen when changing column type for a table with clustered index?

I have a very large table (200M+ row), and it is clustered indexed. I would like to change one of the foreign key column from a bigint to smallint. My questions are: Does SQL need to rebuild the ...
8
votes
3answers
504 views

Documenting a giant web of inter-related stored procedures in an MS SQL database: What tool or format?

I hope this is a question with a shorter answer than "Read a 1000 page book", but then, if that's the real situation, then hit me with it. I am not a real DBA, I'm a software developer who is ...
3
votes
1answer
764 views

On SQL Server Backup: Msg 3271, Level 16, State 1, Server Line 1 A nonrecoverable I/O error occurred on file

I am trying to back up a pretty big database and I keep getting this error: Msg 3271, Level 16, State 1, Server {Server Name}, Line 1 A nonrecoverable I/O error occurred on file "{Backup File ...
11
votes
2answers
2k views

System disk run out of space when running heavy SQL queries on SQL Server 2012

I'm quite new to SQL Server 2012, I would be grateful if someone can help. I have restored a copy of a huge database to SQL Server 2012 and I tried to run some simple queries against it. I'm trying ...
2
votes
1answer
831 views

How to structure Master/Detail tables for performance without denormalizing?

Some Background Info We have a set of tables that holds all the transactions for our system, TransactionHeaders and TransactionDetails. There are roughly 80k Transactions a day which translates to ...
3
votes
1answer
652 views

Giving all permissions to all users for a database in SQL Server

Since the database is created under one user's log in, other users using this computer cannot access this particular database. How can I grant the same privileges to all users who log in to this ...
6
votes
2answers
2k views

What are the differences between SQL I/O Sim and SQL IO tools?

I want to test my different SQL Server alternatives with a benchmark tool. I found two tools by Microsoft: SQLIO Disk Subsystem Benchmark Tool SQL IO Sim What are the differences between them? is ...
2
votes
3answers
309 views

SQL Server : explicitly create an index on a primary key and unique fields

UPDATED: I'll make the question clearer as the first answer isn't quite what I was looking for. How can I execute this create table statement and ensure that the two automatically created indexes ...
6
votes
1answer
361 views

Can SQL Express be used as a Log Shipping monitor server?

I'm keen to setup a "Monitor Server". We have SQL 2008 R2 Enterprise edition on both primary and secondary servers. Can we use SQL Express in monitoring server setup for licencing purposes?
5
votes
2answers
134 views

New Cluster Testing - Best Practice

We've finished setup of a 4-node SQL Server 2005 cluster. We are using Windows 2008 R2 as the underlying OS. We are looking for suggestions on a set of tests we could perform to test failover of the ...
2
votes
3answers
978 views

Is there a way to do data export from Amazon Web Services RDS for SQL Server to On-Premises SQL Server?

We have a large Amazon Web Services RDS for SQL Server instance and we would like to do incremental data transfers from RDS to On-Premesis SQL Server on a regular basis. The On-prem server will be ...
3
votes
1answer
227 views

Select TOP @N where @N is a variable from another Query

I am building a report on server hardware projections, and I'm getting stuck here. I have a query that correctly returns the number of HDD's installed on the server, and am storing that number into ...
14
votes
1answer
2k views

Are there disadvantages to contained databases?

SQL Server 2012 introduced the concept of "contained" databases, where everything (well, mostly everything) the database needs is contained within the database itself. This offers big advantages when ...
3
votes
1answer
63 views

What does this code do?

I found one of my queries was over written with following code: SELECT cp.objtype AS ObjectType, OBJECT_NAME(st.objectid,st.dbid) AS ObjectName, cp.usecounts AS ExecutionCount, ...
2
votes
1answer
231 views

How do I allow remote connection in SQL Server 2008 Express

I've just installed SQL Server 2008 Express. But when I try to connect to database engine via SQL Server Management Studio I get "A network-related or instance-specific error occurred while ...
3
votes
1answer
410 views

How to break out of error loop in transactional replication?

I was running some simple tests on a publisher and subscriber on the same instance: I inserted 50,000 rows into a published article and the data was correctly pushed to the subscriber. I ...
2
votes
3answers
5k views

Questions about handling NULLs and empty strings in nvarchar and numeric fields

I understand that questions similar to these pop up often around here. I have searched before posting these but I didn't find any QA threads that completely answer my questions. In a table, I ...
2
votes
1answer
330 views

Copy database fails while trying to copy login

I'm trying to copy a database from a server that lives in a unique domain, call it AMCO. The destination server, which is on domain BCO, is running sql server agent, and as far as I can tell ...
4
votes
1answer
430 views

Partition Key questions in SQL Server 2008

We are planning to use table partitioning for our database based on an integer column. I have read about it on MSDN at http://msdn.microsoft.com/en-us/library/ms190787.aspx and have few queries. a) ...
8
votes
1answer
598 views

Why are there Victimless Entries on the Deadlock Graph?

I am trying to learn how to analyze SQL Server 2008's deadlock graph, and I'm finding alot of entries with an empty <victim-list> node. I don't understand what these entries represent: if there ...
7
votes
2answers
1k views

SQL Server 'Create Database' statement. How to inherit autogrowth settings?

I am using SQL Server 2008 R2 and creating databases through continuous deployment. In our system, the default 1Mb/10% autogrowth settings in SQL Server work badly with our data. Particularly as we ...
2
votes
1answer
65 views

Should Crystal Report be allowed for certain employees for production database?

I am talking about production database. There are couple of people who use crystal on daily basis for various types of reports. Some use it to just peak at the data, other generate reports of it. ...
2
votes
0answers
128 views

CREATE ASSEMBLY - EXCEPTION_ACCESS_VIOLATION

I am trying to create an assembly on my SQL Server 2005 server. Here is what I am using: CREATE ASSEMBLY [SQLCLRTest] AUTHORIZATION [dbo] FROM 'path\to\my\file.dll' WITH PERMISSION_SET = ...
2
votes
1answer
1k views

sp_execute expects parameter '@handle' of type 'int'

I'm trying to check in a stored procedure if a table exists in my destination database. If it does not then I will create the table useing the information_schema tables from the source database. ...
1
vote
1answer
482 views

Merge replication - can't create snapshot – timeout

I have a SQL Server 2008 database, and I need a merge replication because I want to sync with mobile devices afterwards. So I created a replication but when it comes to start the snapshot agent, the ...
2
votes
1answer
5k views

SQL Server 2012 installation failure An error occurred for a dependency of the feature causing the setup process for the feature to fail

I am installing SQL Server 2012 Developer (from ISO image written on DVD), my machine has Windows 7 (Edit: Windows 7 with service pack 1) and it already has SQL Express and SQL 2008 R2 Express ...
2
votes
2answers
747 views

Is there any way to speed up a query with 3x UNION on the same large table?

Assuming that the following query is legitimate and executes successfully, is there any way to speed it up? SELECT foo from T1 --T1 is a huge (>5e6 rows) table with no indexes UNION SELECT bar ...
3
votes
1answer
171 views

sql server down bad things happens

Following Situation: You have a Database with very high transactions, the Database is about 4100 GBs The Recovery Modell from your Database is full Every week you make a full backup from your ...
6
votes
0answers
207 views

Msg 14027, Level 11, State 1, Procedure sp_MSrepl_addarticle [table] does not exist in the current database [closed]

Before setting up SQL Server snapshot replication, I backed up the database from ServerA and restored it to ServerB. Both servers are running SQL Server 2008 R2 SP1. In trying to setup snapshot ...
4
votes
1answer
694 views

Allow user to do anything within his own schema but not create or drop the schema itself

I have created a schema in SQL Azure and granted the following permissions to a database role: CREATE ROLE myrole AUTHORIZATION dbo; EXEC sp_addrolemember 'myrole', 'myuser'; CREATE SCHEMA myschema ...
4
votes
1answer
488 views

SQL Server 2008 R2 Service Broker Troubleshooting

I set up Service Broker between two databases on separate instances, one on a 2008 R2 Cluster the other on a separate box also 2008 R2. I have gone through the process of setting up all the objects ...
6
votes
3answers
465 views

How do I create a user for SQL Server whose queries (any/all) are time limited?

Is there any way to create a database user in SQL Server 2005 so that none of their queries are allowed to exceed a certain time limit (for e.g 20-30 seconds) or all queries are limited to a certain ...
5
votes
2answers
140 views

Unique Contraint/Index Based On Values

I have a table that has the following column definitions: ID (INT, PK) Name (VarChar) Active (Bit) Bunch_of (Other_columns) Question: I want to have a Constraint on Name/Active such that we can ...
4
votes
1answer
866 views

SQL Server job timeout

So, it seems that it is not possible to set the timeout for each single step in a SQL Server job (article from StackExchange). MSDN points out that you can of course set the Agent timeout: Sql ...
7
votes
2answers
671 views

Merge replication fails on executing query

My merge replication was working fine this morning. Since an hour or 2 ago, my synchronisation status windows keeps showing this message: Thread id 3108 will wait for 15 second(s) before retrying the ...
2
votes
1answer
295 views

SQL SERVER 2008 TVF OR CHARINDEX to search column with comma

ID BlahColumn 1 2 2 NULL 3 2,3 4 4,5,6 5 1,2 6 1 7 1 Hello, I am using the following as part of the where clause and using charindex is not working ...
3
votes
1answer
1k views

Why does altering a table and adding a foreign key create an extra constaint?

Edit: It was a default constraint as a result of setting a default value when adding the column. The name gave it away when starting with 'DF__'. Anyway, solved it by adding the column and manually ...
3
votes
2answers
1k views

SQL Server - In Recovery

Was uploading a few hundred thousand rows in my SQL 2008 R1 database and have come in this morning to an "In Recovery" message next to the database name in SQL Management Studio. I've tried a DBCC ...
1
vote
3answers
85 views

SQL Server database backups

I am looking to do regular backups of my SQL Server databases. Is there any reason why I should not just backup just the MSSQL.10/DATA folder? I've got a great backup solution in place from Rackspace ...
3
votes
1answer
105 views

What is recommended level of security for a production database?

I have a production database on our local server. Currently there are two many logins to the database, about 20, half of them are windows authenticated and the other rest are SQL Server authenticated. ...
4
votes
1answer
176 views

How to set constraints on UDT in SQL Server 2005 - 2012

I'm creating my UDT: CREATE TYPE [dbo].[Code] FROM VARCHAR(20) NOT NULL As RULES and DEFAULTS are considered deprecated, what is the recommended way to set constraint on my type to make sure that ...
10
votes
2answers
1k views

Why does SELECT 1/2 return 0?

As the title says. I even tried SELECT CONVERT(NUMERIC, 1/2) which also returned 0. I am using SQL Server 2008.
1
vote
1answer
323 views

DMZ server unable to connect through SQL Browser

I have a Web server in my DMZ, I have a SQL Server 2008 R2 server inside the LAN, this database server has named instance with a NO dynamic port. I have set as firewall rules the connection from my ...
0
votes
1answer
816 views

How To insert records in SqlExpress Database tables through sqlscript while installing setup?

I'm creating a database and all of my tables using SQL Server Express through SQL scripts. Now, I want to insert some records in tables like States (all states names), city (all city names). How ...
3
votes
2answers
349 views

sp_send_dbmail fails when mailing queries, but no error returned, query just hangs

I have an issue SQL Server 2005. sp_send_dbmail fails when mailing out with the result of a query (inline or attatchment). No error message is given / reported, the query just keeps executing but ...
2
votes
0answers
57 views

How to Remove Articles Based on User

I am using merge replication on SQL 2012. I have a very large database with a large number of tables. The subscribers are using netbooks. I have a filtering scheme that controls which tables end up ...
7
votes
3answers
1k views

SQL Server 2012 Standard Edition - multiple instances and memory utilization

If we have multiple instances of a SQL Server 2012 Standard Edition (which has a 64 GB memory limit) on one server which has 192 GBs of RAM, do both instances only have access to the first 64 GBs of ...