Click here to Skip to main content
15,921,174 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using sql server 2005

alter table dept_locations
drop Constraint [Department Location]


but it didn't work..
Posted

If the key will not be able to be dropped if it is references by another table, ie a foreign key. You must drop all foreign key references before dropping the primary key. Also, the snippet you have does not drop the column, only a constraint.
 
Share this answer
 
I feel ur table must be in relation with other table kindly delete that table first and ur done..

Thanks & Regards
Radix :rose:
 
Share this answer
 
what if the PK has not any FK made .....
then we just wanted to delete it as PK...
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900