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

 All Forums
 SQL Server 2000 Forums
 Transact-SQL (2000)
 add primary key on existing table

Author  Topic 

sagar kumar singh
Starting Member

1 Post

Posted - 2009-09-26 : 13:08:08
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

15732 Posts

Posted - 2009-09-26 : 16:37:35
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

600 Posts

Posted - 2009-09-30 : 04:45:18
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
   

- Advertisement -