以下是部分代码示例:删除外键约束DECLARE c1 cursor for select 'alter table ['+ object_name(parent_obj) + '] drop constraint ['+name+']; ' from sysobjects where xtype = 'F' open c1 declare @c1 varchar(8000) fetch next from c1 into @c1 while(@@fetch_status=0) begin exec(@c1) fetch next from c1 into @c1 end close c1 deallocate c1 --删除表DECLARE c2 cursor for select 'drop table ['+name +']; ' from sysobjects where xtype = 'u' open c2 declare @c2 varchar(8000) fetch next from c2 into @c2 while