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
252 views

Extended event (sp_statement_completed) firing multiple times

I'm using SQL Server 2008 R2 enterprise and this is my first foray into extended events. It's pretty cool stuff. I'm wanting to create a session that will run basically all the time to audit query ...
6
votes
0answers
165 views

Need help understanding query plan: estimates vs. actuals [closed]

I'd like to understand a section of the query plan that seems to mess up my query. The picture shows that there's a clustered index seek, followed by compute scalar, followed by sort. The part ...
2
votes
1answer
450 views

When changing startup parameters on a cluster, does each node have to be updated manually?

When moving a SQL 2005 instance to new disks on a two-node Windows 2003 cluster, I changed startup params on the active node to reflect the new paths for the master DB files and error logs. I ...
2
votes
2answers
299 views

Partitioning a multi-terabyte database [closed]

We have a database which is nearly 3TB in size, out of which 8 tables together are 1.5TB which we want to partition based on year. But as we will be partitioning over a terabyte of data, this will be ...
6
votes
2answers
626 views

Does MERGE use tempdb?

Consider the following query: MERGE [Parameter] with (rowlock) AS target USING (SELECT @AreaId, @ParameterTypeId, @Value) AS source (AreaId, ParameterTypeId, Value) ON ...
0
votes
1answer
3k views

SQL Server does not exist or access denied from a VMWare guest

I've made the configuration to allow remote connections to SQL Server 2012, however I still cannot connect to it from a VMware Workstation Guest (using both NAT and Bridge). I can ping the host ...
9
votes
3answers
3k views

Move multiple databases from C: to D: at once

I have SQL Server 2008 R2 with 323 databases consuming some 14 GB on my C: drive, a fast SSD. Because I want to reclaim some space on my C: drive, I would like to move them to my D: drive. I have ...
2
votes
1answer
2k views

How to insert in table from remote stored procedure without creating a distributed transaction?

How can I insert in a local table from a remote stored procedure without creating a distributed transaction? I want to run a stored procedure on a remote server and use the output as the source for an ...
3
votes
1answer
474 views

Does openquery use distributed transactions?

Does openquery in SQL Server 2005 use distributed transactions? If so, in which cases does it?
1
vote
2answers
132 views

NOT IN in function to parse CSV

I'm trying to pass an array of items to be used in a NOT IN operation: ALTER FUNCTION [dbo].[fnTEST] (@CODES VARCHAR) RETURNS TABLE AS RETURN ( SELECT T1.CODE AS 'CODE', (SELECT ...
7
votes
1answer
119 views

Best way to put checksum on all pages

I have a SQL Server database with the PAGE_VERIFY option set to NONE. When I set this to CHECKSUM, only pages changed from that point onwards get their checksum calculated and stored on the page. I'm ...
3
votes
2answers
1k views

Pulling autogrowth events by file name from default trace

I use below query to get auto-growth event occurred to databases in a sql server. DECLARE @trcfilename VARCHAR(1000); SELECT @trcfilename = path FROM sys.traces WHERE is_default = 1 SELECT COUNT(*)as ...
5
votes
1answer
713 views

Schedule Query and Export

Is it possible, to schedule a simple Query to run Daily and export the received data into an excel file?
3
votes
4answers
3k views

SQL Server audit query that fires a trigger

Using SQL Server, does exist a way to audit from inside a trigger the sql that fires it? I need to know the SQL query that fires a trigger over a database without a profiler. Thanks
1
vote
0answers
96 views

Backup headerinformation hold wrong database name

We're in the proces of preparing our migration to our new servers aswell as SQL 2012 and everything is looking fine and dandy and i'm testing some of the scripts we will be using. One of these ...
1
vote
2answers
5k views

Permissions Needed To Attach AdventureWorks Database

I am trying to add the AdventureWorks database in MS SQL Server Management Studio (SSMS) 2008 R2. As a new person to this area, or noob, this seemingly simple task has caused me much hardship and ...
8
votes
2answers
581 views

function hangs with null case operation

I created a function that accepts a start and end date, with the end date being optional. I then wrote a CASE in the filter to use the start date if no end date is passed. CASE WHEN @dateEnd IS NULL ...
0
votes
1answer
227 views

UPDATE statment with and without SELECT keyword

I have been doing some testing on removing the SELECT keyword from this update: Update #tmpDriverTime Set WorkDay2 = (Select IsNull(Sum(PyblHrs),0) From spr_DriverTimeEntry Where ...
3
votes
1answer
683 views

Will Ola's default IndexOptimizer job update my stats?

I just installed Ola Hallengren's MaintenanceSolution.sql maintenance scripts. After looking at the output of the log generated by the IndexOptimize - USER_DATABASES job, I'm concerned that it's not ...
1
vote
2answers
2k views

Run job once a minute, every day, except during a certain time

I have a Sql server 2012 agent job which currently runs every minute, every day, etc. I'd like to modify it so that it will run every minute, every day except on Saturdays between 7:00 pm and 11:30 ...
2
votes
3answers
672 views

SQL Server data extract with limited performance impact

Background: I have a SQL Server 2008 Enterprise Edition database containing three tables. The tables contain ~3 million, ~14 million, ~14.5 million rows respectively. Problem: I need to do a data ...
1
vote
1answer
88 views

Replication randomly started failing

I have replication set up between two servers. This morning I came in and it was failing. I was getting these errors: Error messages: The process could not execute 'sp_replcmds' on ...
1
vote
2answers
1k views

Reducing size of image returned by view

We are storing a list of images in a table in an image column. These are stored as their raw image size so they can be viewed in their details at full resolution. The problem I have is I want to show ...
0
votes
2answers
999 views

Error using sp_trace_create with parameters [duplicate]

I'm running the following SQL on SQL Server 2000: exec sp_trace_create @options = 2, @tracefile = N'h:\\trace.trc', @filecount = 2 and am getting the following error and can't ...
6
votes
1answer
1k views

Replicated Database Log File Maintenance

I have a database on the publisher that is involved in replication (publication configured for merge and transaction). Trying to regain control of the log file for this particular database (VLF count, ...
2
votes
1answer
757 views

Reading SQL Performance Counters using PowerShell script

I'm trying create a PS script to read some performance counter about my SQL for my Level 1 partners but I'm having a problem with the instance name. I'm using this code: $computer = "\\\" + ...
2
votes
2answers
356 views

Database Last Usage

Is there a way to find out when a database was last accessed on SQL Server 2000? By this I mean, had a table read, a SPROC called etc... I have a list of databases and I am trying to find out which ...
1
vote
2answers
3k views

Is it recommended to use Identity as an alternative to primary key?

We can declare an Identity like id_num so that id_num will have an increment of unique numbers. CREATE TABLE new_employees ( id_num int IDENTITY(1,1), fname varchar (20), minit char(1), lname ...
2
votes
2answers
120 views

How to monitor a single db of an instance in SQL Server

I am trying to program against a vendor supplied database, and would like to understand what SQL statements or procedures they are calling. Is there a way I can monitor a specific database? The ...
1
vote
2answers
197 views

SQL Server 2005 onwards- Capturing Baseline

I want to design a process by which I can capture the baseline data of multiple SQL Server instances (2005 onwards) in a single database from where I can get all the info and alerts. As of now I ...
3
votes
1answer
1k views

How does Log shipping knows to keep track

I have set up log shipping between 2 SQL Servers (SQL Server 2008 and SQL Server 2012). At first i took a full backup of the first one and restored it on the other one and than i set up the log ...
0
votes
2answers
324 views

How does Log shipping knows to keep track [duplicate]

I have set up log shipping between 2 SQL Servers (SQL Server 2008 and SQL Server 2012), At first i took a full backup of the first one and restored it on the other one and than i set up the log ...
7
votes
1answer
155 views

IN and NOT IN for XML column

I have a table with a xml column. Xml is similar to <Root> <Row> <user>abc</user> <Rowid>1</Rowid> </Row> <Row> ...
9
votes
2answers
14k views

Which one is more efficient: select from linked server or insert into linked server?

Suppose I have to export data from one server to another (through linked servers). Which statement will be more efficient? Executing in source server: INSERT INTO ...
4
votes
2answers
4k views

Installing Full Text Search to SQL Server 2008 R2

I installed sql server 2008 R2 Express successfully, then realised I need to get Full Text Search. So I downloaded the "Advanced Services Installation Package", but when I run it there is no option in ...
4
votes
6answers
18k views

Don't use a transaction for Stored Procedure

I have a stored procedure that runs a few commands. I don't want these commands to be wrapped in the transaction of the stored procedure. If the 4th command fails, I want the 1st, 2nd and 3rd ones to ...
2
votes
2answers
251 views

How to join multiple tables (SQL) to find the difference between an order and shipped quantities?

I have a collection of orders that were submitted to an internal ERP, which were processed and partially shipped. The table hierarchy is as follows: Order table contains OrderReference(PO), OrderID ...
0
votes
0answers
26 views

How to join multiple tables (SQL) to find the difference between an order and shipped quantities? [duplicate]

I have a collection of orders that were submitted to an internal ERP, which were processed and partially shipped. The table hierarchy is as follows: Order table contains OrderReference(PO), OrderID ...
0
votes
1answer
95 views

SQL Server Instance Version [closed]

I'm working with a SQL Server with several instances. Four of my instances are at 10.50.2811.0 and the remaining two are at 10.50.1765.0 I've tried running SQL Server 2008 R2 SP1 and CU 6 to get it ...
2
votes
2answers
2k views

SQL server windows authentication through network

I am using sql server 2008 r2.There are about 50 pc in my office connected in network by using LAN.In a sql server 2008 r2 express(installed in windows 8) i have created all users windows account with ...
9
votes
2answers
5k views

Setting variables in SQLCMD mode

Using SQL Server 2008 R2 Enterprise Edition Consider the following statement: :setvar source_server_name "SERVERNAME\INSTANCENAME" Is it possible in SQLCMD mode to get that value using TSQL ...
6
votes
1answer
2k views

linked list in SQL and Trees

Though SQL is more affiliated with table like operations and not so much with recursive, say we would like to implement the linked (or double-linked) list concept (like we have for instance in C). Is ...
3
votes
2answers
71 views

Backing up the database without compromising performance

I have a data base with a size up to 120 Gb and I need do a backup every night. The problem is that the system needs stand operative all the 24 hours. In this moments the backup takes up to 2 hours ...
1
vote
2answers
64 views

Practical way to temporarily shut down a database

What would be the most practical way to shut down a database to access for any user? I need to practically shut down a specific database on a SQL Server for test purposes, and would like to know the ...
3
votes
2answers
1k views

Copy database, problem with not existing principal

I'm trying to copy a database from a server to my laptop, using Management Studio. However, after about an hour of copying, I get the error Cannot find the principal 'MVGSQL01\itsac', because it ...
0
votes
1answer
58 views

What is a good way to replicate code across multiple databases?

SQL Server 2005 I have two databases (Source1 and Source2) with the same data model and I plan to merge the data into a third database (Target) with an "abstracted" data model. In the future, it's ...
1
vote
2answers
664 views

How do I migrate varbinary data to Netezza?

I got a warning message while migrating DDL from SQL Server to Netezza: Warning: [dbo].[spec_binarymessage].[blobdata] data type [varbinary] is not supported the target system and will be scripted ...
7
votes
1answer
654 views

SQL Server not using available memory

SQL Server 2008 R2 Standard Edition (64-bit) on Windows 2008R2 Enterprise Server has over 300 GB of memory but total memory use in control panel never goes over 86 GB Have SQL configured to use ...
4
votes
3answers
1k views

SQLCMD Exporting 16.5 Million Rows

I am exporting a table to a TSV file using sqlcmd, and I am running into issues. The table has 16+ million rows and about 55 columns. The problem is that it does not export the full table, but seems ...
7
votes
1answer
799 views

SSIS organization

I'm familiar with SSMS, but I've never used .net, c# or visual studio (been doing other things: Assembler, c, unix, vi, oracle, etc). I'm trying to figure out basic 2012 SSIS ETL (no BI or data ...