smallbee 发表于 2006-10-27 19:55

[求助]怎样取消的一个属性的的唯一性约束条件

请问各位大侠在sql中是怎样取消一个属性的的唯一性约束条件的.<BR>如:<BR>create table test<BR>(<BR>name char(10) unique);<BR>创建表后怎么才能取消这个唯一性约束啊.

ninggang 发表于 2006-11-21 18:33

<P>我还不知道约束名呢?<BR>  所以最好这样建表<BR> create table test(name char(10) constraint uq_test unique)<BR>然后删除就可以了:<BR>alter table test drop uq_test<BR>另外,如果是在现有列上添加约束可以这样(比如添加一个check约束)<BR>alter table test with nocheck add check (name&gt;22)/*其中with nocheck表示在添加约束时,要对表中的数据与约束不进行检查,其默认为with check表示要进行检查*/</P>

smallbee 发表于 2006-11-30 12:49

<P>谢谢ninggang.</P>

页: [1]

编程论坛