SQL SERVER 数据库清空语句 忽略外键 触发器 等

1 USE  ClothesShop
2 EXECUTE sp_MSForEachTable 'ALTER TABLE ? NOCHECK CONSTRAINT ALL'
3 EXECUTE sp_MSForEachTable 'ALTER TABLE ? DISABLE TRIGGER ALL'
4 EXECUTE sp_MSForEachTable 'DELETE FROM ?'
5 EXECUTE sp_MSForEachTable 'ALTER TABLE ? CHECK CONSTRAINT ALL'
6 EXECUTE sp_MSForEachTable 'ALTER TABLE ? ENABLE TRIGGER ALL'
7 EXECUTE sp_MSFOREACHTABLE 'SELECT * FROM ?'

 

posted @ 2012-10-04 01:33  BinSys  阅读(476)  评论(0编辑  收藏  举报