sqlServer2005 清空数据库中所有数据,表和表结构和约束都不删
有两个地方需要改,
第一行和最后一行的testdb改成你的数据库名
use testdbdeclare @tablename varchar(max)declare havetable cursor for select [name] from sysobjects where xtype='U'open havetablefetch next from havetable into @tablenameWHILE @@FETCH_STATUS = 0begin exec('delete from '+ @tablename) fetch next from havetable into @tablenameendclose havetabledeallocate havetableDUMP TRANSACTION testdb WITH NO_LOG