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)

4
votes
1answer
484 views

Calculating Median Value within a Group By

I have a SPROC which calculates the Mean duration of a request / response cycle within 10 minute intervals. This works well and suits my needs for plotting charts. What I would like to do next is ...
0
votes
1answer
89 views

Logging of incorrect row in SQL Server Integration Services

I newbie to SQL Server Integration Services and I have a problem: Data loaded from file looks like this: 1 'a' 'b' 2 'a' 'b' 1 'c' 'd' And this rows would be loaded in table like this: CREATE ...
0
votes
1answer
171 views

SQL Server using incorrect plan

In our application we have the following tiers for data processing: .NET orchestration application that works out which SSIS packages to fire SSIS packages that do much of the work and call Stored ...
2
votes
2answers
2k views

How to map another server through SQL Server Management Studio

I am trying to map another server by giving the command EXEC xp_cmdshell 'NET USE H:\568.256.8.358\backup_147 1234abc /USER:cranew /PERSISTENT:yes' I got an error with this network path not ...
8
votes
2answers
3k views

For absolute performance, is SUM faster or COUNT?

This relates to counting the number of records that match a certain condition, e.g. invoice amount > $100. I tend to prefer COUNT(CASE WHEN invoice_amount > 100 THEN 1 END) However, this is ...
2
votes
1answer
210 views

Post replication powershell script - on subscriber

I need to execute a command before a replication executes on the publisher, and after, on the subscriber. I seem to have it working on the publisher, by adding another step in the replication agent. ...
3
votes
1answer
976 views

Availability Group reporting disconnected replica [closed]

I'm trying to configure availability groups in a VM environment so I can run some tests. I think I've got the group created correctly, I can see the Always on group on both servers. However when I ...
2
votes
1answer
158 views

tempdb thrashing and mirroring permissions (SQL Server) [closed]

We have a client site that uses SQL Server. The site this morning was slow, and we realised that the primary database server was responsible for a lot of disk activity on tempdb (Server 2008, SQL ...
3
votes
2answers
378 views

Cleaning up transaction replication del/ins/upd stored procedures?

I'm referring to the ones that start with: dbo.sp_MSdel... dbo.sp_MSins... dbo.sp_MSupd... I've noticed they are not removed when I run exec sp_dropsubscription on the Publisher then run ...
7
votes
1answer
1k views

Can Availability Groups provide seamless failover (with no query failures)?

I have been testing the Availability Groups feature in SQL Server 2012 and am finding that there is approximately 15 seconds of down time when the primary server fails over to the secondary server. ...
1
vote
1answer
769 views

How to restore a MySQL file to SQL Server 2008

I have a MySQL file (apple.sql) that I need to restore to a SQL server 2008 database or at least be able to access the database through mySQL. I have created a linked server mySQL, created an empty ...
4
votes
2answers
3k views

Users cannot view tables in non-default schema in SSMS

I'm having an issue setting the VIEW DEFINITION permission appropriately at the schema level for one of my users. I've created the schema TestSchema and added some tables. The user currently has ...
2
votes
2answers
1k views

One database with two schemas: cross-schema View permissions issue?

I have a database on SQL Server 2008 R2 that has two schemas, the default dbo and a new one called Test. I have a view in the Test schema called View1 that selects from dbo.Table1. Both schemas are ...
1
vote
1answer
275 views

Are these database tables normalized?

I am developing a webapp for an institute and I designed these tables: Are these tables normalized?
2
votes
3answers
8k views

Unable to start SQL Server Instance 2008 R2 - DB file corrupt

I was not able to start the SQL Server 2008 R2 production DB instance. After reading the log file error message is " The log scan number passed to log scan in database ‘master’ is not valid. This ...
-1
votes
2answers
432 views

How to gauge knowledge of a SQL Server DBA? [closed]

Not being familiar with SQL Server, I need to evaluate the knowledge of an SQL Server DBA applicant. The job is mostly about increasing performance and finetuning an existing system. Do you have any ...
3
votes
1answer
88 views

Many to many unique combination

So I originally thought I was going to have a one to many relationship in a database with the following tables ENTITY_JSON_MAP ATTRIBUTE_JSON_MAP Originally I was going to have an FK in ...
5
votes
1answer
4k views

Getting a “Request to run job refused because the job is already running” When no job is running?

So have an ETL job that runs through integration services that I start with a SQL job name StartStageStore. The last step of this job is to start another job and report success. The job this calls to ...
2
votes
0answers
74 views

How to display differential backup date in SSMS Object Explorer Details

SQL Server Management Studio exposes the Object Explorer Details (selectable from the View menu option) and its context menu that allows adding fields to the default display. Full and Transaction Log ...
6
votes
3answers
3k views

Attempt to fetch logical page (5:65424) in database 2 failed

I am getting following SqlException on calling a stored procedure - Attempt to fetch logical page (5:65424) in database 2 failed. It belongs to allocation unit 7349876362857938944 not to ...
1
vote
1answer
490 views

Data dictionary best practices in SQL Server 2008 r2 [closed]

We are interested in sharing the meta data and data dictionary among the team. I know that we can use the Extended Properties for this purpose, but based on my experience I've seen it gets out of date ...
1
vote
1answer
176 views

How Can I Isolate A Merge Replication Timeout

I am using merge replication in SQL 2012 with web sync. When I create my subscription I am getting a timeout. The error message is not clear about cause of the timeout, but what I do know is if I ...
6
votes
2answers
1k views

Security and Performance implications of “View Server State”

This question points out that "View Server State" permission is required for various DMV's (dynamic management views), but I can't find anything about who you do and do not want to grant the ...
3
votes
2answers
1k views

Linked Server Query Results: OPENQUERY vs Distributed Transactions

I have two databases. They are on different servers. One is named REPORTDB and the other is named TRANSDB. TRANSDB is referenced as a linked server on REPORTDB named TRANS. I execute a query like ...
2
votes
1answer
702 views

SQL column goes from first to last position in output

I have an SQL query inside a SQL Server Integration Services (SSIS) package where the preview shows the column order correctly, however the actual output uses a different column order. This is ...
3
votes
1answer
208 views

Error when UPDATE all rows

When I update a single row, it works fine. But when I update all rows with: UPDATE cad_bilhetes SET ligacao_acobrar = 'False' I get the following error: Msg 512, Level 16, State 1, Procedure ...
0
votes
2answers
4k views

Couldn't install SQL Server 2012 on machine with Windows 7 SP1, VS 2010 SP1

I am trying to install SQL Server 2012 RTM on my pc, I have installed Windows 7 SP1, VS 2010 SP1 but it again and again giving this error: A network error occurred while attempting to read from ...
5
votes
1answer
2k views

Turning off auto shrink on all SQL Server databases. Why doesn't this work?

I figured I could use sp_MSforeachdb to solve this problem, but I get an error message. sp_MSforeachdb ' BEGIN USE [?] DECLARE @dbid INT SET @dbid = DB_ID() IF(@dbid > 4) BEGIN --PRINT ''[?]'' ...
1
vote
2answers
1k views

Use domain username on SQL server reporting services installed in a server which is part of a Workgroup

I have installed SQL Server 2012 on Windows Server 2008. This system is configured to be part of a Workgroup and all the users in our organisation are part of a domain. I am trying to use the ...
5
votes
1answer
247 views

Is there anyway to make sql server search the master database for SQLCLR stored procedures before the current one?

For T-SQL stored procedures with the prefix sp_, SQL Server will search for and user a procedure in the master database before the current one. This does not appear to be the case with a SQLCLR stored ...
5
votes
3answers
576 views

Disabling logging on certain tables

I'm using SQL Server 2005. I have two tables that contain aggregate information. The information is constantly being updated, generating almost 5GB of log data a day. (That's larger than the entire ...
6
votes
4answers
3k views

What can speed up a SQL count query?

When doing a count (aggregate) SQL query, what can speed up the execution time in these 3 database systems? I'm sure many things could speed it up (hardware for one), but I'm just a novice DBA, so ...
14
votes
2answers
1k views

Why does DELETE leave a lingering effect on performance?

At the end is a test script for comparing the performance between a @table variable and a #temp table. I think I've set it up correctly - the performance timings are taken outside of the ...
6
votes
1answer
343 views

Backup to three drives suddenly slow

The situation: I have a 1.3 TB Database (SQL 2005) that I am currently backing up to 2 network shares on separate machines and on one local USB. (Don't ask why - long story involving a DBA that quit ...
0
votes
1answer
526 views

Length of LOB data (%1) to be replicated exceeds configured maximum %2

We recently hit this error shortly after enabling replication on a table. Length of LOB data (%1) to be replicated exceeds configured maximum %2 I've found solutions to this problem already: ...
3
votes
2answers
3k views

Is there a more concise way to convert a UTC datetime into a local date only?

I am trying to write a query that groups records based on the local date part only of a UTC datetime field. For example, if my table contains 10/19/2012 2:00:00, then it should get grouped as ...
2
votes
2answers
2k views

Fast XML, slow XML

Our database update Windows application needs to transfer some data between two databases as part of the process for a certain one-time update. I chose XML as the intermediary to move the data. The ...
3
votes
3answers
4k views

Altering nullability of column in SQL Server

Say I have the following table: CREATE TABLE test(test_id int not null identity primary key, field1 int not null, field2 int ); CREATE INDEX IDX_test_field1 ON test(field1); CREATE INDEX ...
5
votes
3answers
1k views

When was a table trigger disabled and re-enabled?

I need to know if the enable/disable history of a table trigger is natively tracked by SQL Server. I've reviewed the system views: • [sys].[triggers] contains a modify_date field • ...
4
votes
1answer
2k views

How can I create a stored procedure using xp_fixeddrives?

I need a stored procedure to check the free space in 2 linked servers .(the servers are linked manually) .I have comed up with a query like this and using sql server 2008 ALTER PROCEDURE freespace AS ...
3
votes
1answer
239 views

Do my metrics justify changing the MAXDOP settings?

I recently took over a dual instance virtualized SQL Server with 8 x vCPUs and 8 x physical cores. This is the only VM on the host. MAXDOP is at the default setting. The server has 100 high ...
3
votes
1answer
2k views

Grant select to dbo view without select on non dbo tables

SQL Server 2008 R2 We have a login & user called "JoeBlogs", this user has it's own default schema of JoeBlogs - it has Public access only to the database. We then granted it SELECT on a dbo ...
0
votes
1answer
1k views

How do I connect to a database which is a linked server via ODBC?

(All the searches for this sort of thing tell me about where the linked server is connecting to the original database via ODBC, but I'm connecting to the intermediate server via ODBC.) I have a ...
0
votes
2answers
161 views

SQL Server transaction log [duplicate]

Possible Duplicate: Why Does the Transaction Log Keep Growing or Run Out of Space? Is it possible to have SQL Server 2008 R2 reset the transaction log for certain databases when the ...
0
votes
2answers
809 views

Can you set up a SQL server maintenance plan to restore a database?

I am looking to setup a maintenance plan that makes a backup of a database (Database1) and then restores to another database (Database2) to confirm that it is able to restore successfully. Can I do ...
1
vote
1answer
91 views

Software/Hardware Upgrade

I've been working on a software/hardware upgrade from SQL2005 on win 2003 to SQL2008 R2 SP2 on win2008. The new hardware has 48 cores with 128 gig of ram whereas the older server 16 cores with 32Gig ...
1
vote
0answers
108 views

What permissions are required to view the contents of a catalog on a remote server?

I defined a linked server from a SQL Server box to a MySQL box. I went through a very detailed set of instructions and steps, everything works like a charm when I am logged in. The linked server ...
1
vote
2answers
701 views

Consistency errors for a SharePoint database

When I check my database (SQL Server 2008 R2, Windows Server 2008 R2, SharePoint 2007 DB) with the command: DBCC CheckDB I get 12 consistency errors (see below). Is the only way to fix it with ...
1
vote
3answers
2k views

Putting SQL Server data files in a different partition

I have a SQL Server and I put the data files (the .mdf) on a different partition. Windows runs from C: and the data files and logs are on D: Is it advantageous or disadvantageous to separate the ...
12
votes
1answer
1k views

Where are Statistics physically stored in SQL Server?

Where are the Statistics used by the Query Optimizer physically stored inside a SQL Server database file and the Buffer Pool? More specifically, is there a way to figure out the pages used by ...