home bbs files messages ]

Forums before death by AOL, social media and spammers... "We can't have nice things"

   comp.databases.ms-sqlserver      Notorious Rube Goldberg contraption      19,505 messages   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]

   Message 18,041 of 19,505   
   tshad to All   
   Not dropping temporary table   
   23 Dec 10 11:25:20   
   
   From: tfs@dslextreme.com   
      
   I am trying to drop and reuse a temporary table and I get an error on the   
   second select/into.   
      
   *******************************************   
   IF OBJECT_ID('tempDB..#tfs1') IS NOT NULL   
    DROP TABLE #tfs1   
      
   SELECT * INTO #tfs1 ...   
      
   ...   
      
   DROP TABLE #tfs   
      
   SELECT * INTO #tfs1   
   ********************************************   
      
   This gives me an error:   
      
        There is already an object named '#tfs1' in the database.   
      
   But this seems to be done before actually executing the query.   
      
   Why would that be?   
      
   Obviously it is not there as I dropped it.  I originally had the "IF   
   OBJECT_ID..." that I had before the first drop also before the 2nd drop and   
   thought that maybe that was a problem.  So I just dropped it without testing   
   for it.   
      
   Thanks,   
      
   Tom   
      
   --- SoupGate-Win32 v1.05   
    * Origin: you cannot sedate... all the things you hate (1:229/2)   

[   << oldest   |   < older   |   list   |   newer >   |   newest >>   ]


(c) 1994,  bbs@darkrealms.ca