sql server 清空数据库表数据

--禁用外键约束  

exec   sp_msforeachtable   'alter   table   ?   nocheck   constraint   all '  

--清空数据  

truncate   table   表名  

--启用外键约束  

exec   sp_msforeachtable   'alter   table   ?   check   constraint   all '

原文地址:https://www.cnblogs.com/shy1766IT/p/4474088.html