--删除所有约束.表.视图等SQL脚本 --############################################### --删除所有外键约束 --############################################### DECLARE @SQL VARCHAR(99) DECLARE CUR_CONSTRAINT CURSOR LOCAL FOR SELECT 'ALTER TABLE '+ CASE WHEN O.schema_id IS NOT NU…
查询: SELECT 主键列ID=b.rkey ,主键列名=(SELECT name FROM syscolumns WHERE colid=b.rkey AND id=b.rkeyid) ,外键表ID=b.fkeyid ,外键表名称=object_name(b.fkeyid) ,外键列ID=b.fkey ,外键列名=(SELECT name FROM syscolumns WHERE colid=b.fkey AND id=b.fkeyid) ,级联更新=ObjectProperty(a.id…
--删除所有约束 DECLARE c1 cursor for select 'alter table ['+ object_name(parent_obj) + '] drop constraint ['+name+']; ' from sysobjects where xtype = 'F' open c1 ) fetch next from c1 into @c1 ) begin exec(@c1) fetch next from c1 into @c1 end close c1 deall…
--批量删除用户表 --1.删除外键约束DECLARE c1 cursor for select 'alter table ['+ object_name(parent_obj) + '] drop constraint ['+name+']; ' from sysobjects where xtype = 'F'open c1declare @c1 varchar(8000)fetch next from c1 into @c1while(@@fetch_status=0…