外部キー制約を有効または無効にする文

535 ワード


--             
select  'ALTER TABLE ['  + b.name +  '] NOCHECK CONSTRAINT ' +  a.name +';' as         
from  sysobjects  a ,sysobjects  b     
where  a.xtype ='f' and  a.parent_obj = b.id


--             
select  'ALTER TABLE [' + b.name +  '] CHECK CONSTRAINT ' +  a.name +';' as           
from  sysobjects  a ,sysobjects  b     
where  a.xtype ='f' and  a.parent_obj = b.id