先if(exist())
drop
然后creat啊。

解决方案 »

  1.   

    if object_id('tempdb..#sourceheping') is not null  --判
    begin
    drop table #tmp1
     
    end
    if exists( select object_id('#sourceheping))      -- 
    print 'exists'
    else 
    print 'not exists'
      

  2.   

    String sqlcreate1="if object_id('tempdb.. #sourceheping) is not null drop table #sourceheping create table #sourceheping (parent varchar(50),child varchar(50))";
    String sqlcreate2="if object_id('tempdb.. #tempyjf) is not null drop table #tempyjf create table #tempyjf (parent varchar(50),child varchar(50))";