注册 登录
编程论坛 MySQL论坛

删除约束

herendagao 发布于 2009-09-14 16:25, 2414 次点击
mysql> create table test(
    -> tid int primary key,
    -> tcid int,
    -> constraint tcref foreign key(tcid) references customers(cid),
    -> constraint checktcid check(tcid>1)
    -> );
请问如何删除约束checktcid啊?
alter table test drop constraint checktcid
语句不能删除!
1 回复
#2
gdy03492009-09-14 21:18
mysql应该是没有check约束的,你上面的sql虽然不报错,但不知你发现没,你加的check根本就没起作用,
mysql把他当做摆设一样。也就是说执行完你的sql,根本就没有check约束,所以就不能drop了
1