Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Drop table problem
Message
 
 
To
17/02/2005 09:56:45
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Miscellaneous
Thread ID:
00986632
Message ID:
00987921
Views:
48
Hi Bonnie,

A local temp table created in a stored procedure will be droped when stored procedure is completed. Any other local temp table will be droped when current session is closed. In the first case the scope is stored procedure, in the second - current session. In your example with QA the scope is current session.

>
>You both say that you don't need to drop a #TempTable, but it's good practice to do it. If I'm not mistaken, I think that you *do* have to drop the table, as I thought it persists even after it's gone out of scope.
>
>As an example, in Query Analyzer, I write some code to create a temp table, insert some rows into it, select from it and then drop it ... I run that code all is good. But if I then highlight all the code except the DROP and run it more than once, I get the error "There is already an object named '#temp' in the database."
>
>I guess my question would be then, what "scope" does it have to go out of?
>
>~~
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform