日期:2014-05-18 浏览次数:20558 次
alter table Project drop constraint DF_ID alter table Project add constraint [新约束名] primary key([列名])
------解决方案--------------------
竟然没一个会的……
DECLARE @Constraint_Name varchar (200)
select @Constraint_Name = Name
from dbo.sysobjects
where Xtype = 'PK'
and Parent_Obj = (select [ID]
from dbo.sysobjects
where id = object_id(N'admin')
and OBJECTPROPERTY(id, N'IsUserTable') = 1)
EXEC ('alter table admin drop constraint '+@Constraint_Name )