您的位置:首页 > 数据库

清空 所有用户表中的数据.sql

2007-09-22 15:00 281 查看
declare crsr cursor
for SELECT [name] FROM DBO.SYSOBJECTS
WHERE OBJECTPROPERTY(ID,N'IsTable')=1 and type = 'U' and [name] <> 'dtproperties'
open crsr
declare @tblName sysname
fetch crsr into @tblName
EXEC('truncate table '+@tblName)

while @@fetch_status=0
fetch next from crsr into @tblName
EXEC('truncate table '+@tblName)
close crsr
deallocate crsr
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: