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
2answers
205 views

How to avoid timeouts during big DML operations

I have a big insert script I need to run. Its about 55,000 records and 160 columns. The script is already created and I can't create it again. The problem I have is that this runs for about 4 hours ...
10
votes
2answers
7k views

Need to understand parallel query execution error

Today we experienced a degradation in performance on our production sql server. Durring the time this occurred we logged several "The query processor could not start the necessary thread resources ...
3
votes
1answer
2k views

Cannot rename the table because it is published for replication

I need to rename some tables in my DB - SQL Server 2005, with this: EXEC sp_rename 'dbo.TableName', 'Tmp_TableName', 'OBJECT' but I can't do this - I get this exception - Cannot rename the ...
2
votes
1answer
304 views

Is the Service Broker good for publishing data between servers?

I'm trying to find a better solution when publishing data to a remote table. So we have Server A and Server B. Server A holds a master table which should be replicated to Server B. Currently, we ...
2
votes
0answers
202 views

always on availability group with different speed disks

I'm looking to set up SQL Server 2012 installation with an Always On Availability Group, where the 'passive' replica will be hosted at another site on the WAN and using synchronous data commit - the ...
3
votes
4answers
4k views

Cannot remove unused filegroups

I wanted to remove some unused filegroups/files in a SQL Server Database but am stuck because SQL Server thinks the filegroups/files are still in use. Some background: We had some partioned tables ...
0
votes
1answer
409 views

Full text query slow on first run [closed]

I have SQL Server database which has size of 65GB and 6 million rows. We have essays in tables and the average size of an essay is 450 words. When I run a query for the first time, it takes 3-10 ...
3
votes
1answer
340 views

Splitting different parts of a string

I have an SQL Server database where there is a cell with a delimiter (\) separated string. An example of this string would be: category_path ============= RootCategory\Middle Category\Child ...
4
votes
1answer
6k views

SQL Server Maximum and Minimum memory configuration

What are the correct settings for min-memory and max-memory in this use case? The server has 8GB ram, dual Intel Xeon processors, running Windows Server 2008 R2 / Sql Server 2008 Standard Edition. ...
2
votes
0answers
285 views

A Tool to Manage Tracking Query Performance Improvements [duplicate]

I'm building a BI system on SQL Server 2012. I have a test set of data with some tens of millions of rows. Currently many functions and stored procedures are unacceptably slow. I'm looking for a tool ...
1
vote
3answers
958 views

How can I drop a stored procedure whose name is in a variable?

Given a variable that contains a stored procedure name: DECLARE @stored_procedure_name sysname; SET @stored_procedure_name = 'some_stored_procedure_name'; How can I drop the stored procedure?
2
votes
1answer
5k views

Why is my Amazon RDS instance so slow?

I currently run a Windows Server with SQL Server Express. I'd like follow best practice and separate the application from the database, so I've created an RDS instance and exported my database. ...
2
votes
1answer
3k views

Can not find 'NT AUTHORITY\NETWORK SERVICE'. on Sql Server 2012

Hi How do i fix this Error? when i run my MVC app i get this error though my web.config is find. the error is on my DB call Sample: Cannot open database "Sample" requested by the login. The login ...
1
vote
2answers
1k views

Updating a table efficiently using JOIN

I have a table that has the details of households and another that has the details of all the persons associated with the households. For the household table I have a primary key defined using two ...
1
vote
3answers
1k views

Restore database - maintenance plan task

I need to schedule a task that restores a database once a week from a backup. I have setup maintenance plans for backing up databases (Management > Maintenance Plans) but cannot find out how to make a ...
2
votes
2answers
422 views

Workaround for Anti-Semi Join bug

I built the following SQL Server query, but it is encountering the anti-semi join defect in SQL Server 2005 which results in inaccurate cardinality estimates (1 -- urgh!) and runs forever. Since it is ...
4
votes
1answer
427 views

Understanding MS SQL Server Date Types

Consider the following: declare @dt datetime, @dt2 datetime2, @d date set @dt = '2013-01-01' set @dt2 = '2013-01-01' set @d = '2013-01-01' select convert(varbinary, @dt) as dt, ...
1
vote
0answers
138 views

Optimising Large SQL Server Tables [closed]

I have a large table with around 50 million rows and 15 columns. Whenever I read, I always need all columns so I can't split them. I have a clustered index on the table with 4 keys (ALL INT) and I ...
10
votes
1answer
2k views

AlwaysOn AG, DTC with failover

Problem: How can I run Distributed Transaction Coordinator (DTC) on all servers in an AlwaysOn Availability Group (AG)? I do NOT need to maintain transactions over failover/switchover events. Setup: ...
1
vote
2answers
2k views

How can I “shift” certain column values to different rows in an existing table?

I'm implementing a queue as a ring buffer in a table along the lines of what Thomas Kejser talks about here: Implementing Message Queues in Relational Databases If the ring buffer fills up, I have to ...
1
vote
2answers
3k views

How to make SQL Server Management Studio use latest version of SQL Server?

I'm upgrading my dev machine from Windows 7 to 8. While installing earlier versions of Visual Studio it installed SQL Server 2005. I then went to this site and downloaded and installed SQL Server ...
5
votes
1answer
337 views

How to get output from trigger on linked server

Fair warning, I know this isn't the best way to do this, but I'm trying to extend some existing code without needing to do a rewrite. Anyway, I've got two SQL Server 2012 installs, one local in my ...
0
votes
3answers
303 views

Sql Server 2012 Restoring Master and Migrating a server

I am migrating an entire Sql Server instance with 10 databases on it. It has many sql jobs and users. What is best practice regarding the master database? Should I backup and restore this too, or ...
1
vote
1answer
117 views

Number of times a table is read, written to and updated

Is there a way I can find out the number of times a table is read, updated, added to or has had rows deleted during a trace? I am creating the trace in SQL using sp_trace_setstatus, not using the Sql ...
2
votes
1answer
68 views

Logging and Replaying database updates/inserts SQL Server 2008

I am in the process of migrating our client's database to the Azure Cloud SQL Server and setting up data sync etc. All of this is ok, but I need to reduce the amount of time the client's system needs ...
8
votes
2answers
8k views

How can I see the current Database Mail configuration?

Our SQL Server (2008) instance is configured to send mail and everything is working correctly, but I can't figure out how to view the existing configuration, in particular the SMTP server. From SSMS ...
-4
votes
1answer
172 views

SQL Server 2012 having two database in the same server but different Hard drives [closed]

I am quite new in terms of SQL Server. I tried to search but can't really find any topic related on what I asked, or probably I didn't phrase my search term correctly. Here is what I am trying to ...
6
votes
5answers
2k views

SQL server level permissions

I am aware of the Microsoft provided code to transfer logins between SQL servers, however this only does the account and the password. What if that particular account has various roles and ...
3
votes
1answer
192 views

Forwarded Records, effective way to fix them

I'm dealing with an issue in SQL Server databases of an application. This application is used for Healthcare and I only maintain the databases, I do not create the application. Clients are facing the ...
13
votes
4answers
4k views

Identifying Unused Stored Procedures

This next year, I am helping an effort to clean several SQL Server environments. We have about 10,000 stored procedures and estimate that only about 1000 of them are used on a regular basis, and ...
0
votes
2answers
117 views

Replicate to a secondary database that also allows edits

I have a client with a somewhat odd requirement. They want to be able to take a snapshot of their sales database that their accountants can then use once it's disconnected from the live database. That ...
3
votes
2answers
552 views

Replacing master.dbo.sysperfinfo with sys.dm_os_performance_counters

I'm working with some old code that pulls performance counters, and part of what I'm doing is making sure we're doing some processes efficiently and effectively. Right now I have this code that I'm ...
1
vote
1answer
52 views

Foreign Key off of a UNIONed View

I have a view that looks like this: CREATE view reference.Test WITH SCHEMABINDING as SELECT reference.HighlevelTestId as TestId, Name, IsActive, cast(1 as bit) as ...
1
vote
1answer
457 views

MS SQL Server 2005 DB backup with partitioned tables to non-partitioned SQL Server 2012

I have a database with several partitioned tables on MS SQL Server 2005 Enterprise, and I have to restore this DB on MS SQL Server 2012 Standard. Since Standard doesn't support partitioning - it's a ...
2
votes
1answer
86 views

Which Edition Of SQL Server Is On The Disc? [duplicate]

I have several SQL Server 2008 R2 setup discs, but they're not labelled with which edition (Standard, Developer, Enterprise etc.) they are for. Running them doesn't give much help as it just shows ...
2
votes
2answers
1k views

How can I execute a stored procedure whose name is in a variable?

Given a variable that contains a stored procedure name: DECLARE @stored_procedure_name varchar(512); SET @stored_procedure_name = 'some_stored_procedure_name'; How can I execute the stored ...
4
votes
3answers
164 views

Expanding a dataset based on a weight field

I have a table that contains records in an un-expanded form. Each record has an associated integer weight that essentially informs us how many times the record should be replicated in order to get the ...
-2
votes
1answer
251 views

Query sql-server db and insert results into PostgreSQL

I have a query that returns data from sql-server and I need to be able to put the results into PostgreSQL. I'm using C# for the task.
4
votes
2answers
6k views

Are there any third party tools that can read and/or analyze SQL Profiler trace (.trc) files [closed]

I have a .trc file from a trace that a DBA did on one of my databases. I don't have the SQL profiler tool installed on my PC so I can't view the contents and analyze the trace log. How do I read this ...
2
votes
3answers
401 views

Monthly backup of SQL server DB to PostgreSQL?

The company I'm working for has a SQL Server with read-only access. They use Crystal Reports hooked up to PostgreSQL for reporting. Is there any way to make it so I can move all the data from the ...
4
votes
1answer
2k views

sys.fn_varbintohexstr returns NULL if varbinary data is more then 2000 as datalength

sys.fn_varbintohexstr works fine if VARBINARY data length is upto 2000. If it is greater then 2000, function sys.fn_varbintohexstr returns NULL as result. What I am missing ? DECLARE @testvarbinary ...
0
votes
0answers
52 views

SQL Server Grouping with row value basis [duplicate]

I have a child table that is something like this: [Mach Status Table] | Mach Status | Start Time | Duration| +----------------+-------------+-----------+ | 1 | 2012-04-30 6:30 | ...
3
votes
1answer
2k views

Cannot Connect Using SSMS to Local SQL Server 2008 R2

About six months ago my vendor installed SQL Server 2008 R2 into a clustered pair of servers, DB01 and DB02. I've been logging on, periodically, to DB01 to audit some of the data contained in the ...
2
votes
1answer
875 views

Inline edit SQL Server database rows from Visual Studio

I'm pretty sure Microsoft have pulled one of the most useful features for performing quick edits on a SQL Server Database within the Visual Studio IDE. It seems to have only affected SQL 2012 ...
0
votes
3answers
194 views

Do database engines update when the updated value is the same? [closed]

Suppose I am running multiple column update on one row. Does the database engine physically write new data to the database if some of the columns contain the same values as existed previously in the ...
1
vote
1answer
55 views

Altering strings while selecting them

I'm working in SQL Server 2008, I have a varchar(255) column in my table, I want to select out all of the strings which contain the ':' character, and select the first part of the string before (but ...
2
votes
2answers
129 views

Can you direct Availability Groups to fail over to a particular node?

Can you direct Availability Groups to fail over to a specific node in the cluster?
4
votes
2answers
353 views

Security : SQL Server Object Access From One Schema to another schema

Scenario: I have denied permissions from table1 for USER1. DENY SELECT,INSERT,UPDATE,DELETE ON OBJECT :: dbo.table1 TO USER1 Instead, I have allowed access to a view(vw_table1) which will selects ...
2
votes
1answer
109 views

Mysterious missing transactional replication tokens

I am looking at implementing Transactional Replication subscriptions in an AlwaysOn AvailabilityGroup. I tried to use this as a guide: ...
4
votes
2answers
2k views

Splitting a large SQL Server MDF file

I have a large (1.2 terabyte) SQL Server database that I need to migrate to a new server. Most of the database lives on a single, 1.25 TB data file, and a little bit sits on a much-more-manageable 550 ...