All versions of Microsoft SQL Server (not MySQL). Please also add a version-specific tag like sql-server-2016 if that is relevant to the question.

learn more… | top users | synonyms (2)

3
votes
1answer
83 views

Standard ways to return SQL Server database to a specific state

What are the most efficient ways to save the exact state of a SQL server database and then be able to bring it back to that state at will? I am testing code performance against a database and each ...
2
votes
1answer
960 views

Error installing Clustering with SQL Server 2012 on Windows Server 2012

We are installing SQL Server 2012 on Windows Server 2012 and trying to accomplish clustering. We've setup all the core functionality on the servers: advanced cluster preparation on all nodes and ...
1
vote
1answer
3k views

How to pass a table of values to a stored procedure from SSIS?

I am really new to SSIS, so I apologize for the "dumb" question. I know open ended "Best Practices" questions are seriously frowned upon, so I will try to be as specific as I can. I have a basic SSIS ...
-1
votes
1answer
337 views

Why do I need Transaction logs at all [closed]

We use Microsoft SQL Server as a repository of images and data about those images. We record in real time and never care about recovery. If the database slows down and can't handle the number of ...
-1
votes
1answer
734 views

default value with select case on xml

select case 'NULL' when 'NULL' then 'f' end as out output: f but select case (select (SELECT LEFT(l.list,LEN(l.list)-1) FROM (SELECT o.Reciting_Path + '|' + o.Declaimer +',' AS [text()] ...
1
vote
1answer
198 views

Data Compression Enhancement in SQL Server 2012

Is there any specific enhancements in SQL Server 2012 for Data Compression Feature? Last time I checked SQL Server 2008 R2 introduced support for Unicode characters so columns with NCHAR data types (...
11
votes
2answers
34k views

SQL Server 2008 R2 error: 15023, user, group, or role already exists

I have a test database that I'm having permissions issues with. I can't access the reporting database, and the application's help documentation says to do the following: Resolution: 1. Launch the ...
1
vote
1answer
604 views

SQL Server 2008 Script Changes from Database Diagram

I have a database diagram which I have made several changes to using SSMS, however instead of committing the changes I want to generate a SQL script to apply them instead. Is there a simple way to do ...
0
votes
0answers
273 views

Publishing SQL Server in mdf format onto GoDaddy SQL Server admin [closed]

I have created a website with a database in .mdf format. I successfully uploaded my website and created a database in GoDaddy windows hosting. Can anyone tell me how to publish a locally created ...
1
vote
0answers
243 views

Performance implications of the NEWSEQUENTIALID() re-sequence on restart

I see a very good case why I should use NEWSEQUENTIALID() as PK. It would be internal to my system and has good performance similar to IDENTITY() but better than NEWID(). However, NEWSEQUENTIALID() ...
0
votes
1answer
2k views

Database stuck in restoring mode during log shipping

The error log say - The database is marked RESTORING and is in a state that does not allow recovery to be run.
0
votes
0answers
239 views

SQL Server 2008 R2 replication server runs faster than primary

I run a simple query like select * from table and I get the following results: primary database : 90 seconds replication database : 2 seconds The tables are identical and have the same indexes in ...
1
vote
1answer
72 views

Adding index in table suggestion?

I have a table called Products with ID(PK, Clustered), Name, Price, Brand, ...., RetailerID, SKU, ModelNumber. My query have SELECT .... FROM Products WHERE RetailerID = @RetailerID AND ( (@...
0
votes
1answer
493 views

TEMPDB Round Robin is not working!! It is filled up

I have a 16 Core CPU processor and I have created 8 tempdb datafiles with initial size as 2,000 MB with 10% growth restricted to 10,000 MB. The log file is unrestricted and it is in simple recovery ...
1
vote
1answer
245 views

how to prevent dropping sysadmin user by another user in sql server

I have a legacy application installed on my server which has configured to work only with one user "sa" and there is time bomb like script written inside this application which whenever it finds ...
0
votes
2answers
595 views

SQL Server 2000 - How to find unused indexes

In SQL Server 2000 - how can we find unused indexes, so that we can drop them.] I have scripts for 2008 but don't know how to do it in SQL Server 2000. Please help. Regards
6
votes
1answer
1k views

Better to use a RANGE RIGHT or RANGE LEFT Partition Scheme

I'd like to know if it is better to use a RANGE RIGHT partition scheme or a RANGE LEFT partition scheme? Is one of these options by default a better choice, or is it heavily dependent on the actual ...
5
votes
2answers
2k views

Deploy SQL Server Backup Maintenance Plan in multi-tenant environment

We have a multi-tenant environment in which I've been trying to deploy a standardised maintenance plan across all servers. I've been running into issues importing the maintenance plan properly, as ...
2
votes
3answers
130 views

MS SQL Server instance name

Quick question guys! Will there be any issues if I use the default instance (MSSQLSERVER) for both test and production environments? They are on separate physical servers. I'm using MS SQL Server ...
2
votes
2answers
6k views

How to send an alert based on SQL Query results

I currently have a maintenance plan in place that does a backup, re-indexing, etc. If a task fails, it sends me an email alert. I would like to add a "T-SQL Statement Task" that will execute a query ...
3
votes
1answer
595 views

Best practices for handling language

I am a coder, not a database admin, so my question may be a little obvious to some. I just cannot find the correct search term to find the answer. I'm trying to create a database structure for both ...
3
votes
2answers
2k views

What does a TRUNCATE TABLE write to the Log file in SQL Server?

I know it does not log everything like a DELETE would but I am not sure what it would write to the log file.
3
votes
1answer
6k views

SQL server agent job built on SSIS package not working

I transferred a job from the old SQL Server 2005 to an upgraded SQL Server 2008 R2 instance, and I scripted out everything, changed the data source and other details... "This job should copy some ...
2
votes
1answer
275 views

Does a SQL server unique constraint partially or fully fail a multi-row write?

If some rows of a writing query fails a unique constraint, will only those writes be rejected, or will the entire query fail?
2
votes
1answer
770 views

Stop and Start the Instance In a Job

I have SQL Server job. In the last step of the job, I want to stop/start SQL Server. Next, I created .bat file with NET STOP "MsSqlServer" I tried SSIS package that uses the execute process task ...
5
votes
1answer
950 views

Database having only db_datareader shows invalid properties for a index

If a SQL server database user has only public permission in server roles and for a particular database only db_datareader and public permission then while trying script index as CREATE To option in ...
5
votes
1answer
288 views

Transactional Replication: can create 52 publication, but creating 53rd leads to problems

My apologies in advance for a long post, but I was really trying to make sure I do my due diligence before turning to the community for help, so here it goes. I am working on a proof of concept with ...
3
votes
1answer
7k views

Sql Server Fix Users

I Create a user in my database with following command : CREATE USER Test WITHOUT LOGIN I created a login with the Test Name. I want to link Test user with Test Login. When I use following command ...
1
vote
2answers
773 views

Are logs in the LDF file being removed after a checkpoint?

Using the fn_dblog I can get the active portion of the online transaction log of my database. But after every checkpoint I can only see 2 entries showing the beginning of the checkpoint ...
4
votes
2answers
1k views

Should I add multiple secondary indexes to search

I have a search screen on my app where the users can use up to 4 parameters to search. I have written a stored procedure to facilitate the search. Select ID, FirstName, LastName, ...
0
votes
2answers
140 views

Copying a restoring database in SQL Server 2012

I've got two SQL Servers, one of these servers (Server A) is backing up transaction logs on some database and uploading them to the other (Server B). Unfortunately I have no access to Server A, I ...
2
votes
0answers
51 views

Identical query & instance but other execution plans & performance [duplicate]

I have 2 identical queries . One is executed with parameters, the other is executed with hardcoded values. Somehow sql server is creating 2 different execution plans for the 2 queries. The first one ...
0
votes
0answers
77 views

SQL Server 2008R2 - Data Collection

I set up Data Collection for simple and basic monitoring of instances of SQL Server 2008 R2 (/2012) (is simple, accessible for and with very nice colors for my boss :-) But one of instances showing ...
1
vote
1answer
5k views

Difference between Clustered Index and Unique Clustered Index? [closed]

I got difference between clustered index and unique index here. But what is the exact difference between clustered index and unique-clustered index? AFAIK creating clustered index can be done for a ...
1
vote
2answers
3k views

SQL Server 2012 error when exporting to Excel

Let me start off by saying I know little and less about SQL. I received a .bak file from a client earlier today and they want me to move it to a new database (not SQL). I've created a SQL Server 2012 ...
1
vote
1answer
139 views

How, when and why does implicit changing of transaction isolation level happen?

RCSI (Read Committed Snapshot Isolation) is the setting of a database changing the behavior of (the default) Read Committed isolation level in SQL Server. This is, as I understand, the context of ...
0
votes
0answers
352 views

How to move SQL server transaction replication from one server to another server [closed]

Currently we have SQL Server 2005 as a publisher and SQL 2008 R2 as subscriber for one of our database (about 350 GB in size). I want to move the replication to our different server (Which also has ...
0
votes
2answers
282 views

SQL Server - Server name same as the instance name and most common use for instances?

Is the server name the same thing as an instance name? I have looked around and am not sure; I think they are but I don't just want to guess. Also, what is the most common use for SQL instances? I ...
0
votes
1answer
313 views

SQL Server Stored Procedure - Does Raiserror affect performance

Does RAISERROR in a SQL Server stored procedure affect performance? Would I be better off just having a try-catch wrapper around the whole procedure and just catch the errors in the database access ...
2
votes
1answer
36 views

How to restore a database from the SQL 2008R2 log? [duplicate]

Today, for a great oversight, did a deal with a big mistake, which I forgot to put the WHERE keyword in the UPDATE statement... I searched in the google, I found a lot of things of how to restore the ...
0
votes
0answers
179 views

Recover deleted records from filestream-enabled table

I have a SQL Server database that I wrongly executed a delete script on it that removed an important records from a filestream-enabled table called Images. after the execution immediately I created a ...
0
votes
1answer
61 views

Harden a public login to only let it retrieve a list of other logins, and do nothing else

I'd like my app's login dialog to give users a drop-down-list of login names on the server. So I'm wondering about the most secure way to retrieve this. The best I can come up with is a login with a ...
2
votes
1answer
1k views

Can geography datatype Lat/Long properties be returned using a view in SQL Server 2008?

Hopefully the question is fairly self-explanatory. I've been ferreting through the, what appears to be quite minimal/poor microsoft documentation regarding both views and geography datatypes in the ...
0
votes
1answer
555 views

Drop & re-add subscribers to transactional replication

I'm trying to get Stored Procedures to execute on the subscribers, as seems to be best practice. I already have transactional replication running happily. I add a new sproc, and set properties of ...
3
votes
0answers
46 views

Any checklist/guide when transferring a database to a new server? [duplicate]

I'm looking for steps that I need to follow to transfer a database to a new server. So far I have: I restored the current database that I have in SQL Server 2005 instance to another SQL Server ...
5
votes
1answer
534 views

What is the limit on the number of INSERT statements you can paste into SSMS and run?

I am currently creating a stored procedure that populates a table with a list of insert statements so that my DBAs can export the contents of the table to a text file and then paste the statements ...
5
votes
1answer
60 views

Database Log file Backup

I was wondering if the Database Backup .bak Contain the Log file. i found that the space different between the database and backup is form the locked space for the database. but i didn't found any ...
3
votes
2answers
43k views

Windows could not start the SQL Server (mssqlserver) service on local computer error 17058

I'm working with virtual machine on the windows 8. There is a SQL Server 2008 on the virtual machine. And in the services; when I try to start the SQL Server service getting an error like this: Can ...
3
votes
1answer
3k views

Get identity value of all rows inserted

I can use Scope_Identity() to get the last identity value inserted into an identity column. But how can i get identity values of all rows which are inserted in a insert statement? Example insert ...
4
votes
1answer
402 views

Why clustered index scan?

I just started to learn to optimize my queries and to analyze their query plans. I thought this query would generate nonclustered index seek + key lookup. SELECT ct.* FROM Person.ContactType AS ct ...