Solved

Add Primary Key (Clustered Index) while database is online MSSQL

Posted on 2013-06-13
2
330 Views
Last Modified: 2013-06-14
Hi Experts!

I would like to ask if is it possible to add primary key to a database that is online and used by production? I haven't tried yet, I'm scared having the database crash.

By the way, I'm using SQL Server 2005 Standard Edition.

Cheers!
0
Comment
Question by:MediaBanc
2 Comments
 
LVL 23

Assisted Solution

by:Racim BOUDJAKDJI
Racim BOUDJAKDJI earned 250 total points
Comment Utility
I haven't tried yet, I'm scared having the database crash.
Don't worry it won't.  You will simply have a slowdown during the index creation.
0
 
LVL 2

Accepted Solution

by:
vivekkumarSharma earned 250 total points
Comment Utility
It completely depend on the volume of data into your table you want to add primary Key.

Try to do this during off peak hours.
It will not affect too much, Just a slowdown may be noticed.

Go Ahead, Don't worry. DB will not crash.
0

Featured Post

Backup Your Microsoft Windows Server®

Backup all your Microsoft Windows Server – on-premises, in remote locations, in private and hybrid clouds. Your entire Windows Server will be backed up in one easy step with patented, block-level disk imaging. We achieve RTOs (recovery time objectives) as low as 15 seconds.

Join & Write a Comment

Introduced in Microsoft SQL Server 2005, the Copy Database Wizard (http://msdn.microsoft.com/en-us/library/ms188664.aspx) is useful in copying databases and associated objects between SQL instances; therefore, it is a good migration and upgrade tool…
JSON is being used more and more, besides XML, and you surely wanted to parse the data out into SQL instead of doing it in some Javascript. The below function in SQL Server can do the job for you, returning a quick table with the parsed data.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Via a live example, show how to extract information from SQL Server on Database, Connection and Server properties

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

13 Experts available now in Live!

Get 1:1 Help Now