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)

0
votes
2answers
295 views

Access denied when disabling agent job, despite SqlAgentOperator membership

I am attempting to disable a SQL agent job from an account which a member of the SqlAgentOperator role (but not sysadmin) The doco says this should be possible 3 SQLAgentOperatorRole members can ...
2
votes
1answer
340 views

Getting the most out of SQL Server with a million rows a day [closed]

I have a windows service that is inserting 1000 rows at 1 minute intervals to a SQL Server 2008 Standard database table that looks like: id, datetime, key_id, value key_id is a foreign key to ...
0
votes
1answer
204 views

SQL Server hangs on a specific record

For some reason my database is hanging on a specific record: SELECT id FROM Foo WHERE id = 40469; Executes right away: SQL Server Execution Times: CPU time = 0 ms, elapsed time = 0 ms. ...
0
votes
1answer
407 views

Why would running a SQL query overnight break my database for the following day?

I apologise in advance if this is a duplicate question (which I bet it will be). I had a good search through and found similar questions but nothing that seemed an exact match. I wrote a report that ...
1
vote
1answer
380 views

Slow query and Insert with trigger

I have vehicle tracking system application based on PHP, SQL Server 2008 R2 Enterprise Edition with XEON HP Z800 Server. My database is growing day by day in millions and it makes it very slow to ...
4
votes
2answers
1k views

SQL Server tail log backup fails where it shouldn't

I am trying to set up a demo of backing up the tail of the log in case of disk failure, but it doesn't work as expected. The setup: Set AdventureWorks backup model to "Full", create a full, a ...
3
votes
0answers
334 views

Did the Change Tracking internals change from SQL Server 2008 to 2012?

In trouble shooting an issue with synchronizing disconnected devices with a central database server, we are experiencing a problem after upgrading to SQL Server 2012 on the server. It appears that the ...
1
vote
1answer
72 views

User mapping problem during deployment

I have a development machine with a new database I have designed. The server has a login L1 and the database has a user U1. L1 is mapped to M1 and tables have permissions set up for U1. Authentication ...
3
votes
2answers
7k views

How to break SQL script execution

I am working on sql script and I am having a requirement of stop continuing the script if some conditions are not satisfied. When I Google it, I found the RaisError with 20 severity level will ...
2
votes
2answers
400 views

SQL Server 2008 R2 : A Possible indexing strategy for the given schema?

We have these four tables: Store ( row bigint, id uniqueidentifier, name varchar ) Products ( row bigint, id uniqueidentifier, storeID uniqueidentifier, productname ...
0
votes
2answers
1k views

What is the difference between Completion and Success in SQL Server Maintenance Plans?

Using SQL Server 2008/R2 Maintenance Plans to setup some automated backups/cleanups and notifications. One thing that I can't figure out is what is the difference between Success and Completion? The ...
1
vote
0answers
180 views

How to check what stats were used in query

respected DBAs . . . is it possible to tell when statistics were last accessed by a query using T-SQL? I'm trying to ascertain what statistics are involved in a query, I know I can check the visual ...
1
vote
2answers
132 views

Why doesn't running a full sample *always* improve query performance

Conventional wisdom would suggest that running a full sample of statistics would provide SQL with the optimum information to make the best decisions when forming a query plan for execution and ...
0
votes
1answer
180 views

SQL Server Database Design for Reporting

We are designing a reporting solution for survey results. Although datasets are reasonable in size (rarely more than 500.000 respondents and 50 questions), performance is obviously a major concern. ...
3
votes
1answer
3k views

Is there a difference between granting SELECT a user and adding them to the db_datareader role?

I was asked to grant SELECT, INSERT and UPDATE to a given user for all tables in a database. I ended up adding the user to db_datareader and granting them INSERT and UPDATE at the database level. ...
1
vote
2answers
407 views

Constant values in columns

I have a SQL Server 2000 database used by our ERP system. There are many columns that always have the same value. A table row is really huge, potentially exceeding the maximum row size in SQL Server ...
1
vote
0answers
429 views

How to shut down clustered SQL Server 2008 R2 with NOWAIT?

Is it possible to shutdown with nowait on a clustered instance? I want to delay recovery to when the instance starts, and I want to shut down as quickly as possible without issuing checkpoints to my ...
3
votes
2answers
405 views

Efficiently query MAX over multiple ranges

When performing a MIN() or MAX() over a single range covered by an appropriately sorted index, SQL Server does a TOP() and so returns the value after fetching just one row. When the search criteria ...
3
votes
1answer
646 views

Dynamic file name for file import

I'm trying to figure out a way that I can pass a filename into a stored procedure that can import a file. However, after setting up the SQL dynamically, the object can't be found. DECLARE @fileName ...
2
votes
1answer
2k views

varbinary to varchar or nvarchar

When retrieving a text value, which has been stored in a varbinary field, and converting back to text, is there a way to determine whether it was stored as a VARCHAR or NVARCHAR string? If it is ...
1
vote
1answer
2k views

How to setup SSL in SQL Server 2012 with own certificate?

Environment: Windows 7 Professional x64 in a domain, running SQL Server 2012. I have local admin rights, so messing up the system is easy. My SQL Server instances are SQLEXPRESS and MSSQLSERVER. FQDN ...
0
votes
0answers
57 views

Why should be Mysql considered over Mssql in a live working scenario? [closed]

Why should be Mysql considered over Mssql in a live working scenario? I am working in a private software company and i am a fresher and i have been instructed to move from Mssql to Mysql. But i ...
7
votes
2answers
5k views

What steps are necessary to safely restart a machine hosting Microsoft SQL Server?

Are there any special steps necessary to prevent data corruption when restarting a server hosting an MS SQL instance? For example, I recently encountered the recommendation of stopping the SQL ...
1
vote
1answer
200 views

Stored procedure to validate xml content against dtd

I have a stored procedure which creates xml content and then is stored to a xml file. Is it possible to validate the generated xml content against a dtd file? Thank you in advance!
0
votes
2answers
291 views

Find missing indexes

tool available to find missing indexes in mssql 2008 ? can we find the missing index using Database Engine Tuning Advisor
1
vote
2answers
2k views

Freeing space after deleting rows [duplicate]

I have a SQL Server 2008 instance and one table is quite large (log data) so I delete old logs. Now I start to read articles on this problem, here is one. As I see it there is no solution! If I ...
1
vote
0answers
168 views

UPLOCK to avoid multiple reads

Given the following table structure... Orders ====== OrderId int PK OrderEvent =========== OrderEventId int PK OrderId int FK EventTypeId int FK I've got multiple concurrent processes SELECT-ing ...
2
votes
1answer
78 views

Is there a way to auto resume an incomplete job after sql server restart?

I ran into problem of job stopped after the sql server restart. Is there a way to auto resume an incomplete job after sql server restart? Thanks!
4
votes
2answers
2k views

Comparing binary 0x and 0x00 turns out to be equal on SQL Server

It seems that SQL Server considers 0x and 0x00 equal values: SELECT CASE WHEN 0x = 0x00 THEN 1 ELSE 0 END This outputs 1. How can I get true binary bit-for-bit comparison behavior? Also, what are ...
4
votes
5answers
42k views

How to access a SQL Server database from other computer connected to the same workgroup?

I have created a C# application which uses a SQL Server database. I have other computers connected to me and to each other in a workgroup. I have shared my C# application with others. When they open ...
3
votes
4answers
2k views

Query to find GUID's “not in” null containing subquery returns no results

When I have a query that checks if a column of type uniqueidentifer does not exist in a table that has a null value then I get no results back. If the subquery does not return a null it works fine and ...
1
vote
1answer
1k views

Unable to drop non-PK index because it is referenced in a foreign key constraint

I have a table named MyTable. The primary key is an identity int column named MyTableID. There is a unique clustered index on the PK column MyTableID named PK_MyTable. I noticed there is an ...
1
vote
1answer
667 views

DBCC checkdb showing failure after a restore

We restored a backup into a new database. After running a few delete queries we received the following message: Msg 824, Level 24, State 2, Line 1 SQL Server detected a logical ...
1
vote
1answer
2k views

What is the difference between TABLESAMPLE(10) and TABLESAMPLE(10 PERCENT) in SQL SERVER 2012

My understanding of the use of TABLESAMPLE is that it returns the top n percent of rows in a result set where TABLESAMPLE(n) So I wrote the following queries to just check (as I'm learning T-SQL) ...
1
vote
1answer
426 views

Replication is missing a specific set of rows on subscriber

So I've got two servers, we'll call them Server A and Server B. Server A has a table, Table 1, which gets replicated to Server B. Server B has a table, Table 2, which gets replicated to Server A. ...
2
votes
3answers
249 views

Trace and analyze logs on SQL Server

I am using an SQL Server 2012 on windows datacenter 2012 I have encountered a situation where i think some virus/sql injection had heart my database, Some data on my table had changed to weird ...
2
votes
2answers
184 views

Large number of VLF and shrinking the log

If there are lot number of VLF then it will effect the performance of the queries. I saw that solution is to shrink the log file. But shrinking the file is also bad. So how to take control of whole ...
4
votes
2answers
579 views

Trace flag and which need to be turned off and Why

In SQL server there are so many trace flags. Why some of them need to be turned off. Some where i saw that trace flag 8017 need to be turned off. So i want to know which trace flag need to be tuned ...
0
votes
1answer
997 views

Migrating from SQL Server to MySQL using MySQL Workbench tool

I'm trying to migrate few tables from SQL Server to MySQL using MySQL Workbench migration wizard. All work fine for structure migrations but when I go to the data migration section it throws an error ...
1
vote
0answers
316 views

Allow developers to run database maintenance

We use the database solution by Ola Hallengren. We're trying to give our developers a way to run the maintenance stored procedures after they do an ETL. Our developers have locked down permissions. ...
1
vote
1answer
446 views

Find Duplicate Customers

Okay... I have a table that has customers: -- Individual Table * ID (Internal Unique ID) * IndividualID (External Unique Individual Identifier) * Last Name * First Name * Birth Date * SSN * ... The ...
0
votes
1answer
97 views

Can scheduled and continous replication configurations exist side-by-side on the same master/slave servers?

Environment We have a core sql server cluster. This cluster contains some databases that get replicated to a load-balanced sql cluster of currently 3 servers. These databases are replicated each 12 ...
1
vote
2answers
414 views

Where can I find scenarios to work through T-SQL [closed]

I've been working through the exam guides for the new 70-461 MCSE data exams and i'm at a point where I want to practice my T-SQL. Does anyone know of any good resources whereby scenarios are posed ...
1
vote
2answers
2k views

How to make SSMS upper case keywords

I recently started using Management Studio 2012. When using MySQL Workbench, a handy feature was that I could stay all in lower case and any reserved word (like SELECT, INSERT) would convert to upper ...
10
votes
2answers
2k views

SQL Server transaction log backups: test whether tail log follows last known log backup

We are using SQL Server with full recovery mode. Given a full backup and a series of log backups, we would like to be able to check whether the log chain is complete from the last full backup to the ...
3
votes
1answer
211 views

Optimizing complex join predicates [closed]

Table Definitions CREATE TABLE [dbo].[Pin_Mtg] ( [MtgId] bigint NULL, [CntyCd] char(5) NOT NULL, [BatchDt] int NOT NULL, [BatchSeq] int NOT NULL, [MtgSeq] tinyint NOT NULL, ...
2
votes
2answers
766 views

How can you tell when a query plan reuse is causing performance problems

When investigating a performance issue, a workmate suggested running DBCC FREEPROCCACHE to clear the plan cache. He came to this conclusion after noticing performance improved after a reboot. This ...
0
votes
1answer
614 views

Msg 1833, File 'ABC.ndf' cannot be reused until after the next BACKUP LOG operation

I am having a Database. The size of my database is near about 4GB(Only .mdf file). In that database only few tables present which have the maximum data of database. One of them and the biggest table ...
5
votes
2answers
205 views

'Cleanse' a SQL Server database file created with Instant File Initialization enabled?

I have Instant File Initialization enabled on our SQL Server, so the 'empty' part of the database file is not zeroed before being allocated. My understanding is that this means that the file could ...
2
votes
2answers
526 views

configure sqlcmd to automatically run your script every time it starts?

I have created a sqlcmd startup script that i have stored in c:\myscript.sql, and I want it to run every time i start sqlcmd. how do I configure sqlcmd to automatically run your script every ...