SQLServer 删除所有表的外键约束
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)
begin
exec(@c1)
fetch next from c1 into @c1
endclose
c1deallocate c1
郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。