USE [数据库名]
DECLARE @Table VARCHAR(100)
DECLARE myCursor CURSOR FOR
SELECT t.name FROM sys.tables t
OPEN myCursor
FETCH NEXT FROM myCursor
INTO @Table
WHILE
@@FETCH_STATUS=0
BEGIN
EXEC(‘TRUNCATE TABLE ‘+@Table+‘‘)
FETCH
NEXT FROM myCursor INTO @Table
END
CLOSE myCursor
DEALLOCATE
myCursor
适用情况:数据库表之间没有什么约束
有约束的没有测试