-- 生成删除约束语句
select 'ALTER TABLE [' + b.name + '] drop CONSTRAINT ' + a.name +';' as 删除约束
from sysobjects a ,sysobjects b
where a.xtype ='f' and a.parent_obj = b.id and a.name like '%ON_CR_TRIANGLE_TYPE_ID'
select 'ALTER TABLE [' + b.name + '] drop CONSTRAINT ' + a.name +';' as 删除约束
from sysobjects a ,sysobjects b
where a.xtype ='f' and a.parent_obj = b.id and a.name like '%ON_CR_TRIANGLE_TYPE_ID'
本文介绍了一种通过SQL查询来生成删除特定约束语句的方法。该方法利用sysobjects表来筛选符合要求的外键约束,并构造出相应的ALTER TABLE语句以供执行。
1408

被折叠的 条评论
为什么被折叠?



