首页 > 其他 > 详细

恢复和去掉所有表约束

时间:2014-03-19 21:19:52      阅读:438      评论:0      收藏:0      [点我收藏+]
bubuko.com,布布扣
--去掉所有表约束
declare
@n nvarchar(max) declare allTable cursor for select name from sys.tables open allTable fetch next from allTable into @n while @@fetch_status = 0 begin exec (ALTER TABLE +@n+ NOCHECK CONSTRAInT ALL) exec (ALTER TABLE +@n+ DISABLE TRIGGER ALL) print(已经去掉表+@n+的约束) fetch next from allTable into @n end close allTable deallocate allTable




bubuko.com,布布扣
--恢复所有表的约束
declare
@n nvarchar(max) declare allTable cursor for select name from sys.tables open allTable fetch next from allTable into @n while @@fetch_status = 0 begin exec (ALTER TABLE +@n+ CHECK CONSTRAInT ALL) exec (ALTER TABLE +@n+ enABLE TRIGGER ALL) print(已经恢复表+@n+的约束) fetch next from allTable into @n end close allTable deallocate allTable
bubuko.com,布布扣

 

bubuko.com,布布扣

恢复和去掉所有表约束,布布扣,bubuko.com

恢复和去掉所有表约束

原文:http://www.cnblogs.com/langu/p/3612196.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!