zoukankan      html  css  js  c++  java
  • 恢复和去掉所有表约束

    --去掉所有表约束
    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




    --恢复所有表的约束
    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
  • 相关阅读:
    python sys 模块
    python os 模块
    JS Dictionary
    JS Array
    JS String
    JS面向对象
    WPF中INotifyPropertyChanged用法与数据绑定
    JS的函数
    JS类型转换
    JS变量的作用域
  • 原文地址:https://www.cnblogs.com/langu/p/3612196.html
Copyright © 2011-2022 走看看