创建临时表

--判断临时表是否存在
if exists (select * from tempdb.dbo.sysobjects where id = object_id(N'tempdb..#TEMP_TBL') and type='U')
begin
 truncate table #TEMP_TBL
end
ELSE
 begin
  create table #TEMP_TBL(
   ID   int IDENTITY (1,1)  primary key   not null, --创建列ID,并且每次新增一条记录就会加1
   xjh nvarchar(max),
   zf  nvarchar(100)
  );
 end

posted @ 2014-01-26 13:42  牡丹  阅读(93)  评论(0)    收藏  举报