unique约束的删除方法

select * from sysconstraints where id=object_id('表名')
drop constraint 约束名
go

sysconstraints
包含约束映射,映射到拥有该约束的对象。该系统目录存储在每个数据库中。
列名 数据类型 描述 
constid int 约束号。 
id int 拥有该约束的表 ID。 
colid smallint 在其上定义约束的列 ID,如果是表约束则为 0。 
spare1 tinyint 保留。 
status int 位图指示状态。可能的值包括: 
1 = PRIMARY KEY 约束。
2 = UNIQUE KEY 约束。
3 = FOREIGN KEY 约束。
4 = CHECK 约束。
5 = DEFAULT 约束。
16 = 列级约束。
32 = 表级约束。
 
actions int 保留。 
error int 保留。 

很奇怪的方法
請試用:
select * into #temp from 表名
drop table 表名
select * into 表名 from #temp
drop table temp
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值