delete from dbo.syscolumns where stype ='pk' and name =主键名
此时会出错,得执行
sp_configure 'allow updates', 0 -- 此时不允许修改值
sp_configure 'allow updates', 1 --允许对系统表进行修改
RECONFIGURE WITH OVERRIDE -- 更新使用 sp_configure 系统存储过程更改的配置选项的当前配置
如要删除字段pri_id
delete from sysobjects where
xtype='pk' and name ='pri_id'
评论