代码改变世界

随笔档案-2017年04月

SQL语句查询表中的所有约束

2017-04-07 09:57 by 小猫爱吃清蒸鱼, 7301 阅读, 收藏,
摘要: select * from sysobjects where parent_obj in(select id from sysobjects where name='表名') 或者 exec sp_helpconstraint @objname='表名' 阅读全文

删除数据库中的所有表,同时忽略约束

2017-04-06 14:03 by 小猫爱吃清蒸鱼, 282 阅读, 收藏,
摘要: select 'drop table '+name+';' from sys.tables select 'alter table '+name+' nocheck constraint all' from sysobjects where type='U' 阅读全文