declare @trun_name varchar(8000) declare name_cursor cursor for select 'delete from ' + name + ' DBCC CHECKIDENT ('+name+', RESEED,0)' from [sysobjects] where xtype='U' open name_cursor fetch next from name_cursor into @trun_name while @@FETCH_STATUS = 0 begin print @trun_name fetch next from name_cursor into @trun_name end close name_cursor deallocate name_cursor --exec sp_msforeachtable "truncate table ?"