如题,谢谢

解决方案 »

  1.   

    create table #t(id int)insert into #t select 1 union select 2select * from #tdrop table #t
      

  2.   

    用object_id判断,这是对于全局临时表##而言。对于#这类的局部临时表,超出作用域就没意义了,不用判断。如下面语句执行会出错,
    create table #t1
    (
    id int
    )
    goselect * from #t1
      

  3.   

    更正一下,查看全局临时表要在tempdb里面去找。
      

  4.   

    我是想这样做的,在前台下指令后,如果后台SQL里已经存在这个临时表,就删除这个临时表,如果不存在就重新建立,而不要等到它执行指令报错才发觉
    要怎么做才能做到呢?
      

  5.   

    create table #t(id int)insert into #t select 1 union select 2select * from #tdrop table #t
      

  6.   

    select * from tempdb..sysobjects where type='u'