我如何删除主键... [英] how can I delete a primary key ...

查看:93
本文介绍了我如何删除主键...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用sql server 2005

更改表dept_locations
放置约束[部门位置]


但是它不起作用.

I am using sql server 2005

alter table dept_locations
drop Constraint [Department Location]


but it didn''t work..

推荐答案

如果该键被另一个表引用(即外键)将无法删除.您必须先删除所有外键引用,然后再删除主键.另外,您拥有的代码段不会删除该列,而只是删除一个约束.
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.


我觉得您的表必须与其他表相关,请先删除该表并完成..

谢谢与问候
基数:rose:
I feel ur table must be in relation with other table kindly delete that table first and ur done..

Thanks & Regards
Radix :rose:


如果PK没有制成任何FK .....
然后我们只想将其删除为PK ...
what if the PK has not any FK made .....
then we just wanted to delete it as PK...


这篇关于我如何删除主键...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆