打赏

sql语句添加删除外键及其约束

--删除外键

ALTER TABLE t_base_role_module

DROP CONSTRAINT fk_t_base_role_module_t_base_defined_url;

--增加外键

ALTER TABLE t_base_role_module

ADD CONSTRAINT fk_t_base_role_module_t_base_defined_url

FOREIGN KEY (module_id)

REFERENCES t_base_defined_url (module_id)

ON DELETE CASCADE;

--不检查约束
alter table 表 nocheck constraint fk_name

--检查约束
alter table 表 check constraint fk_name

posted @ 2017-03-31 21:50  海米傻傻  阅读(5227)  评论(0编辑  收藏  举报