最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

sqlserver通用的刪除服務(wù)器上的所有相同后綴的臨時(shí)表

 更新時(shí)間:2012年05月27日 23:08:37   作者:  
因?yàn)轫?xiàng)目需要,必須使用大量臨時(shí)表,因此編寫批量刪除臨時(shí)表的通用語句
復(fù)制代碼 代碼如下:

use tempdb
if object_id('tempdb..#table') is not null drop table tempdb..#table
select name into tempdb..#table
from (select * from sysobjects where xtype='U') a where
a.name like '%test_select'

declare @table varchar(100),@count int
select @count=count(name) from tempdb..#table

while(@count>0)
begin
select top 1 @table=name from tempdb..#table

exec('
if object_id('''+@table+''') is not null drop table '+@table+'
delete from tempdb..#table where name='''+@table+'''
')
set @count=@count-1
end
drop table tempdb..#table

建議:盡量不要大量使用臨時(shí)表,因?yàn)槭褂胻empdb庫會(huì)使系統(tǒng)的負(fù)載加大。

相關(guān)文章

最新評(píng)論

广安市| 交城县| 普宁市| 余姚市| 通州区| 兰溪市| 城市| 松潘县| 交城县| 连云港市| 玛多县| 英超| 桦甸市| 昌乐县| 桓台县| 汉川市| 开远市| 大英县| 江油市| 九寨沟县| 平罗县| 乐山市| 泰州市| 盘山县| 方山县| 洛南县| 九寨沟县| 临武县| 佳木斯市| 抚松县| 五指山市| 阳东县| 鄂托克旗| 游戏| 蓬莱市| 秀山| 黄平县| 绩溪县| 东乌| 巴塘县| 霍山县|