SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 add primary key on existing table
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

sagar kumar singh
Starting Member

India
1 Posts

Posted - 09/26/2009 :  13:08:08  Show Profile  Reply with Quote
i have a table emp in my table eid have some duplicate data and now i want to add primary key on that column without cheeking previous data
is this possible help me____

SK SINGH

robvolk
Most Valuable Yak

USA
15688 Posts

Posted - 09/26/2009 :  16:37:35  Show Profile  Visit robvolk's Homepage  Reply with Quote
Since the primary key enforces uniqueness, you'll have to remove the duplicates otherwise it will fail.
Go to Top of Page

Nageswar9
Aged Yak Warrior

India
600 Posts

Posted - 09/30/2009 :  04:45:18  Show Profile  Reply with Quote
Hi,
if u dont have any duplicate value in particular column, then use this

Alter table table_name add constraint pk_tabl primary key (column)
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000