???SQL??????????????б??????
???????????? ???????[ 2016/3/4 14:04:26 ] ????????????? SQL
????????????????????????????????????????????????????????????????????????????鷳???????????SQL?????????????????.???????????????????.??????????MS SQL SERVER.
????1.?????????б?????????????SQL???
????declare @trun_name varchar(8000)
????set @trun_name=''
????select @trun_name=@trun_name + 'truncate table ' + [name] + ' ' from sysobjects where xtype='U' and status > 0
????exec (@trun_name)
?????÷??????????????????????????????????????????????????????????????.
????2.?????α????????б?
declare @trun_name varchar(50)
declare name_cursor cursor for
select 'truncate table ' + name from sysobjects where xtype='U' and status > 0
open name_cursor
fetch next from name_cursor into @trun_name
while @@FETCH_STATUS = 0
begin
exec (@trun_name)
print 'truncated table ' + @trun_name
fetch next from name_cursor into @trun_name
end
close name_cursor
deallocate name_cursor
???????????????????????????洢???????? ????????????б?????????????????????????????.
????3.???????δ??????洢????
????exec sp_msforeachtable "truncate table ?"
?????÷????????????????б????????????????.
??????
???·???
??????????????????
2023/3/23 14:23:39???д?ò??????????
2023/3/22 16:17:39????????????????????Щ??
2022/6/14 16:14:27??????????????????????????
2021/10/18 15:37:44???????????????
2021/9/17 15:19:29???·???????·
2021/9/14 15:42:25?????????????
2021/5/28 17:25:47??????APP??????????
2021/5/8 17:01:11