Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Function To Test For Table Doesn't Work
Message
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Miscellaneous
Thread ID:
01328338
Message ID:
01328544
Views:
10
>A Temp table only exists for the current session, correct? Is there any reason to put a DROP statement in there then?

When a local temp table will be dropped depends on where it's created. If it is created in a stored procedure, it'll be dropped when SP ends. Otherwise it'll be dropped at the end of the current session.
You can create a temp table in SP with the same name as temp table that exists before SP is called. It's not defined in T-SQL which one will be referenced inside the SP.
To be safe, I always drop a temp tables at the beginnig and end of any SP that uses temp tables.
--sb--
Previous
Reply
Map
View

Click here to load this message in the networking platform