use databaseName
declare @tblname char(100)
declare @sql char(5000)
declare table_cursor cursor for select name from sysobjects where name like ‘tb_card[_]%‘ and name<>‘Tb_card_regist‘ and name<>‘Tb_card_item‘ and name<>‘Tb_card_discrule‘ and name<>‘tb_card_packagesetdetail‘ and name<>‘tb_card_packagedetail‘ and name<>‘tb_card_exchangeitem‘
and name<>‘tb_card_package‘
open table_cursor
fetch next from table_cursor into @tblname
WHILE @@FETCH_STATUS = 0
BEGIN
set @sql=‘delete from ‘+@tblname
exec(@sql)
print ‘delete ‘ +@tblname + ‘successful‘
fetch next from table_cursor into @tblname
END
close table_cursor
deallocate table_cursor
时间: 2024-12-28 01:11:21