つい、カッとなって作った。後悔はしてない。
use tempdb
declare @tbl varchar(100),@sSQL nvarchar(1000)
declare cu cursor for
select
s.name
from
sys.objects s
where
s.type in (N'U')
and s.name not in ('MST_CODE_TBL')
open cu
fetch next from cu into @tbl
while @@fetch_status = 0
begin
set @sSQL=null
set @sSQL='truncate table ' + @tbl
Execute sp_executesql @sSQL
fetch next from cu into @tbl
end
close cu
deallocate cu
0 コメント:
コメントを投稿