Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Drop table problem
Message
 
 
À
17/02/2005 09:56:45
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Divers
Thread ID:
00986632
Message ID:
00987921
Vues:
44
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--
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform