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 2005 Forums
 Transact-SQL (2005)
 How to delete primary key?

Author  Topic 

ryanlcs
Yak Posting Veteran

62 Posts

Posted - 2009-07-25 : 10:29:31
I got a table with primary key. I had delete the table earlier on, now wanted to re-create the table with same primary key, but it gives me error saying the object "primary key's name" exist, cannot proceed, how can I delete it?
Thanks.

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-07-27 : 03:49:57
ALTER TABLE DROP CONSTRAINT.

Look it up in BOL.
Go to Top of Page

ryanlcs
Yak Posting Veteran

62 Posts

Posted - 2009-07-27 : 05:43:46
It is not working.
Go to Top of Page

RickD
Slow But Sure Yak Herding Master

3608 Posts

Posted - 2009-07-27 : 06:29:09
Thats nice. Did you look it up the syntax to use in BOL? You do know that BOL is the SQL help file, right?

I very much doubt it and therefore can't be bothered to help you more as you can't be bothered to help yourself, so good luck.
Go to Top of Page

rajdaksha
Aged Yak Warrior

595 Posts

Posted - 2009-07-27 : 09:28:02
ALTER TABLE <Table_name> DROP CONSTRAINT <CONSTRAINT_NAME>



-------------------------
R..
Go to Top of Page
   

- Advertisement -