注冊(cè)會(huì)員,創(chuàng)建你的web開發(fā)資料庫(kù),--創(chuàng)建臨時(shí)表 create table #t ( myid int not null, mycd varchar(20) null ) --刪除臨時(shí)表
declare @tmptable nvarchar(300) if exists(select name from tempdb..sysobjects where name like '#t'+'%' and type = 'u') begin set @tmptable='' set @tmptable=(select name from tempdb..sysobjects where name like '#t'+'%' and type = 'u') exec('drop table '[email protected]) end go --說(shuō)明 /* 臨時(shí)表的命名規(guī)則: #t 表示本地變量 ##t 表示全局變量 */