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

Changing a column data type from datetime to float

I have a table with a float column. All values in this column for all records are NULL. I want to change the data type to datetime. I executed the query: ALTER TABLE MyTable ALTER Column MyColumn ...
2
votes
1answer
321 views

DBCC CHECKDB ERROR Msg 8992

I have got the Following Error When i ran the checkDB over the database. What are the steps can be taken to resolve the issue. Without affecting the users. Msg 8992, Level 16, State 1, Line 2 Check ...
2
votes
1answer
1k views

Is data encrypted by ENCRYPTBYPASSPHRASE() protected by the service master key?

In a recent question, What does the Service Master Key protect?, it was suggested that the service master key protects, among other things, data encrypted by ENCRYPTPASSPHRASE(). Is this true?
7
votes
2answers
3k views

Database size - MDF too large?

I'm maintaining a SQL Server 2005 database which hosts approximately 2.9Tb of data (2 x 1.45Tb - I have a RAW schema and an ANALYSIS schema so basically two copies of the data ingested). The recovery ...
1
vote
0answers
194 views

How can I look up table relationships in SQL if I don't have physical/logical models? [closed]

What is the best way to look up/learn table relationships in a database that I'm not familiar with and I don’t have any Logical/Physical models available? Is there a tool that I can use? I’ve been ...
5
votes
3answers
3k views

EF Code First uses nvarchar(max) for all strings. Will this hurt query performance?

I have some databases created using Entity Framework Code First; the apps are working and in general I'm pretty happy with what Code First lets me do. I am a programmer first, and a DBA second, by ...
1
vote
3answers
2k views

restore could not start database

Restore failed for Server 'servername'. (Microsoft.SqlServer.SmoExtended) System.Data.SqlClient.SqlError: RESTORE could not start database 'ECP'. (Microsoft.SqlServer.Smo) The database is ...
1
vote
1answer
552 views

Advice needed for Querying DateTimeOffset data by end users

We are building an Operational Data Store (ODS). The data is coming from our production databases which are located in the United States and Asia. The data in our production databases store date/time ...
1
vote
1answer
3k views

Passing column names dynamically to UNPIVOT

I have a table with following data First Second Third Fourth Fifth Sixth 2013-08-20 2013-08-21 2013-08-22 2013-08-23 2013-08-24 2013-08-25 And ...
-2
votes
1answer
387 views

SQL Server 2008 component is cluster-aware? [closed]

Which SQL Server 2008 components are cluster-aware? Notification Services Tuning Advisor Full Text Search Reporting Services Integration Service
1
vote
1answer
1k views

Schema Change/Update script for Database deploy [closed]

I have a need to change the database schema . I'm planning to write Schema change and update scripts for tracking database changes and updating them. I followed Versioning Databases – Change Scripts ...
5
votes
2answers
1k views

Dividing DBCC CHECKDB over multiple days

I'm working on implementing Paul Randal's method of manually spreading DBCC CHECKDB over several days for very large databases, which basically consists of: Dividing the tables in the database ...
3
votes
1answer
333 views

Index will be removed

I'm trying to simply change the length of a column within a table through SQL Server Management Studio, but receive a 'Validation Warning': 'MyTable' table -Warning: The following schema-bound ...
3
votes
1answer
974 views

How to troubleshoot db/app latency during transaction log backup

I have an application that uses a SQL server (2008 R2) database and we are periodically having performance problems with the application and it coincides with our 15-minute transaction log backups. ...
0
votes
3answers
495 views

Dividing in SQL

can anyone explain to me why this query returns 0.000? SELECT CAST(20/1024 AS NUMERIC(10,3)) I am just trying to do a simple conversion of MB to GB Thanks
1
vote
1answer
62 views

SQL SERVER 2012 error [closed]

am trying to restore a backup, the backup is from a database in the current instance, want to restore the backup with a different name for test purposes, this was possible in 2008 R2 but in 2012 its ...
3
votes
2answers
389 views

Truncated copy of a DB for a developer

I have an access to a DB (SQL Server 2008 R2). The size of the DB is about 40GB. I am a developer and I'd like to have a local copy of that DB to be able to work offline. Is there an easy way to get ...
5
votes
1answer
228 views

My log file is large, what should I do? [duplicate]

My transaction log is larger than I'd like it to be, and I want to know how I can fix that.
1
vote
2answers
866 views

Error in running SQL Server script

I copied oldDatabase as newDatabase. Modified newDatabase's schema. Meanwhile, oldDatabase's data are processing and updating. I want to copy oldDatabase's data to newDatabase. What I have done ...
1
vote
2answers
497 views

Run Multiple Scripts In One Transaction Across Multiple Servers [duplicate]

We have deployment scripts that we need to run on databases that are spread across multiple servers. One script only runs on one database, but the scripts depend on each other. We are looking for a ...
3
votes
2answers
2k views

SQL Server 2012 High Availability on VMware virtualization

We're going to host a large SQL Server 2012 under a VMware virtualization and we need it to be highly available. These are the three options I found supported, but couldn't find a lot of info and ...
0
votes
0answers
19 views

SQL Server 2012 High Availability on VMware virtualization [duplicate]

We're going to host a large SQL Server 2012 under a VMware virtualization and we need it to be highly available. These are the three options I found supported, but couldn't find a lot of info and ...
0
votes
1answer
434 views

Renaming Sql Server database unusual result

This is some behaviour I observed from renaming databases. What is the cause of this? The example is simplified for the purposes of this question. CREATE DATABASE [Database_A] GO CREATE DATABASE ...
4
votes
2answers
480 views

Equivalents to `ora_rowscn` in other databases?

Do other databases other than Oracle have ora_rowscn (http://docs.oracle.com/cd/B19306_01/server.102/b14200/pseudocolumns007.htm) equivalents, or do you have to implement them yourself in your fields, ...
6
votes
1answer
296 views

Why does my SQL Server show more than half a million active tasks?

select task_state,count(*) from sys.dm_os_tasks group by task_state I ran the above statement on a SQL Server instance, and found it had about 633,000 records. task_state -------------- ...
1
vote
0answers
328 views

No SQL Server instances show in upgrade setup

I'm trying to upgrade SQL Server 2005 sp4 to SQL Server 2008 R2. However on the upgrade wizard doesn't show me any instances to upgrade. Any ideas? The instance is there just fine. I can connect ...
1
vote
1answer
3k views

SQL Server 2012 Express fails at repair install, produces error 5178

My SQL Server Express Service will not start up. To produce this problem, I basically cloned my old hard drive (Which had SQL Server Express 2012 installed) to a new hard drive (Seagate Momentus XT ...
2
votes
1answer
137 views

Merge replication issue : conflicts with new data

I set up merge replication with SQL Server 2008, I am having issues when creating new data on clients and trying to synchronize with the remote server. Pulling data from the server works fine. But ...
4
votes
1answer
358 views

performance issue caused by IO?

Just curious to get an issue sanity checked . . . I'm trying to ascertain whether a performance issue experienced by users is the result of the app, server it sits on or SQL Server. Looking at ...
1
vote
1answer
291 views

Error creating XTP Table in SQL Server 2014 CTP1 with Powershell

Having a couple of hours to play I created a SQL Server 2014 box on Azure and followed This SQLServerCentral Post to create a File Group and table with T-SQL. All good. I then decided to take a look ...
1
vote
2answers
7k views

Splitting a large table to improve performance

This is a follow-up to an earlier question. I have a SQL Server 2008 R2 Standard server, that holds a single database, which itself has almost nothing except a large table. The table is 100+ million ...
0
votes
1answer
1k views

How to create a trigger in a different database?

Is it possible to create a stored procedure that creates a table trigger (DDL) in a different database than the one the stored procedure itself resides. The databases are on the same server instance. ...
0
votes
1answer
776 views

Extract time portion of Datetime2(7) in hhmmssfff format

I need to extract the time portion of a datetime2(7) column in hhmmssfff format and I am doing it like this: DECLARE @mdate AS DATETIME2(7) SET @mdate = '2012-03-15 10:13:27.5437431' SELECT ...
4
votes
1answer
249 views

View with fallback (performance/optimization question)

I have a table with tariffs for stuff; the tariffs table is not important in this scenario, the "tariff values" are. In this Demonstration SQL Fiddle the tariff_plan is the FK to the tariffplans table ...
3
votes
1answer
155 views

Execution Plan Regeneration

we have a database server with Sql Server 2008R2 that runs some queries every day; now these queries are fast (I suppose Sql Server has in memory some good execution plans). If we restart the ...
3
votes
2answers
13k views

The value could not be converted because of a potential loss of data [closed]

Let me start out by clarifying that this is not a duplicate question, nor a potential duplicate for that matter. I have tried implementing every answer to every single variant that already exists of ...
0
votes
3answers
372 views

How can I insert '&' symbol in data

I have a source table where one of column has data like: Column SD SD .. .. JK Jk .. .. I want to load this data into staging in format of: Column S&D S&D .. .. J&K J&k .. .. ...
4
votes
1answer
194 views

Distributed transaction and Read Committed Snapshot

Distributed transactions are not supported for snapshot isolation level in SQL Server 2008 R2. But what about read committed snapshot?
1
vote
1answer
238 views

Avoiding table level locking [closed]

I am maintaining a queue in a database table. An SSIS package checks the queue every two minutes. If it finds anything then it runs a job. I am experiencing some sort of table level locking. The ...
2
votes
3answers
2k views

Unique constraint across two columns

I need to add a constraint with two columns that says if any given value is present in one of the columns, then: 1) It cannot be duplicated in the same column. 2) It cannot be duplicated in the ...
2
votes
3answers
246 views

What Are the Log File Names?

I moved my database files. When I go attach the MDF file by itself, SQL Server will tell me that it can't find the log files. How do I go about asking the MDF what files it is expecting before ...
1
vote
1answer
139 views

Detect Convert_Implicit usages

I suspect that my Sql Server is using CONVERT_IMPLICIT a lot because many of my fields are set as string in NHibernate while they are set as varchar in database. Is there any option to detect when ...
-1
votes
2answers
113 views

How do I avoid duplicate rows using FREETEXT?

I have the following query: SELECT cat.CategoryId,cat.CategoryName,cat.CategoryImageURL,cat.CategoryImageData, ap.AppName,ap.AppImageData,ap.AppDetails,ap.AppId FROM Category cat,App ap WHERE ...
1
vote
4answers
5k views

How do I delete only related records in a multi-key MERGE in SQL Server?

Suppose you have something like this: Source table (variable): Values ( LeftId INT NOT NULL, RightId INT NOT NULL, CustomValue varchar(100) NULL ) Target table: Mapping ( LeftId INT NOT ...
23
votes
1answer
4k views

What event information can I get by default from SQL Server?

I often see questions where people want to know if a certain thing happened, or when it happened, or who performed the action. In a lot of cases, SQL Server just doesn't track this information on its ...
1
vote
0answers
48 views

Backing up the SQL Application

I have a Windows 2008 R2 server that needs to be periodically reset to a clean state. Normally I would look at creating an image of the system drive, however due to organizational reasons I cannot use ...
1
vote
0answers
485 views

Transactional Replication Failing Suddenly - Distributor Error

I have two databases (both SQL Server 2008 R2) taking part in transactional replication. This exists to pass data to a customer of ours, so I am troubleshooting from the Publisher side. Replication ...
3
votes
1answer
3k views

Large table and poor performance - what to do next?

We have a Windows 2008 R2 / SQL Server 2008 R2 (Standard) server that is used to host a single database. The database itself mainly consists of a single large table containing both live and historical ...
0
votes
2answers
312 views

Drop a SQL Server database

Taking too long to drop a 500gb+ SQL Server database. My question being what ways can we drop a database other than through GUI or T-SQL? Would deleting the .mdf and .ldf files from the server help? I ...
3
votes
1answer
901 views

Restoring database to UNC path on local drive

When I try to restore a database using a restore command with a local UNC path: RESTORE DATABASE [dbname] FROM DISK = N'\\PC91\D\backup.BAK' WITH FILE = 1, MOVE N'test' TO N'\\PC91\D\dbname.MDF', ...