--加个判断
if object_id('tempdb..#aa') is not null 
  drop table #aa
select * into #aa

解决方案 »

  1.   

    OBJECT_ID
    返回数据库对象标识号。语法
    OBJECT_ID ( 'object' )参数
    'object'要使用的对象。object 的数据类型为 char 或 nchar。如果 object 的数据类型是 char,那么隐性将其转换成 nchar。返回类型
    int注释
    当该参数对系统函数可选时,则系统采用当前数据库、主机、服务器用户或数据库用户。内置函数后面必须跟圆括号。如果指定一个临时表名,则必须在临时表名前面加上数据库名,例如:SELECT OBJECT_ID('tempdb..#mytemptable')示例
    下面的示例为 pubs 数据库中的 authors 表返回对象 ID。USE master
    SELECT OBJECT_ID('pubs..authors')下面是结果集:----------- 
    1977058079   (1 row(s) affected)
      

  2.   

    if exists(select * from sysobjects where name like '#aa')
      drop table #aa
    select * into #aa 
    from t_list_operation inner join t_list_floor on 
    t_list_operation.list_floorid=t_list_floor.list_flooriddeclare cur_tmp cursor for
    select * from #aa.......drop table #aa
      

  3.   

    --加个判断
    if object_id('tempdb..#aa') is not null 
      drop table #aa
      

  4.   

    if exsist(select name from sysyobjects where name='#aa' and type ='u')  drop table #aa