Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Creating temporary table
Message
From
04/02/2014 14:25:05
 
General information
Forum:
Microsoft SQL Server
Category:
SQL syntax
Environment versions
SQL Server:
SQL Server 2008
Application:
Web
Miscellaneous
Thread ID:
01593184
Message ID:
01593201
Views:
25
>All # temp tables are created in the TempDB database. The memory table variable @tableList is also created in the TempDB. I am not sure why do you need to worry much about them. The TempDB database is automatically recreated every time the server is re-started.

Ok

>The temporary table is dropped automatically by SQL Server when the session creating this table is closed. So, you don't have to DROP table at the end of the session although you may. I believe I read in Transact-SQL MSDN forum by both Tibor K and Erland Sommarskog that it's better to let SQL Server to drop these tables rather than perform manual clean up.

So, if the hit executes about 20 SQL select commands, where I have four of them eligible for this new approach, after each select execution, this is disappearing from TempDB. By that, I mean that I am calling a Data class, which has a method SQLExec(). So, once I get out of that method, thus the select has been executed, it means that TempDB no longer has a trace of the #Temp table. Is that correct?

Do I also need to worry about uniquess here for the name of #Temp or SQL Server handles it by itself?
Michel Fournier
Level Extreme Inc.
Designer, architect, owner of the Level Extreme Platform
Subscribe to the site at https://www.levelextreme.com/Home/DataEntry?Activator=55&NoStore=303
Subscription benefits https://www.levelextreme.com/Home/ViewPage?Activator=7&ID=52
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform