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
 SQL Server Development (2000)
 primary key already exist

Author  Topic 

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2006-10-17 : 09:33:27
I try to add primary key in a table but got error:

there is already an object named 'pk_mytable'

How to fix it?

Sun Foster
Aged Yak Warrior

515 Posts

Posted - 2006-10-17 : 09:36:41
If I delete this table, problem will be solved.
Is there another way without drop this table and add primary key?
Go to Top of Page

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2006-10-17 : 10:47:10
[code]ALTER TABLE mytable
DROP CONSTRAINT pk_mytable
[/code]

Harsh Athalye
India.
"Nothing is Impossible"
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2006-10-17 : 11:22:28
Do you want to make more than one column as Primary key?
Read about Composite primary key

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -