Please start any new threads on our new site at We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
Save Password
Forgot your Password?

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

sagar kumar singh
Starting Member

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____


Most Valuable Yak

15732 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

Aged Yak Warrior

600 Posts

Posted - 09/30/2009 :  04:45:18  Show Profile  Reply with Quote
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  
 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.03 seconds. Powered By: Snitz Forums 2000