views:

174

answers:

1

Hi guys,
I have a vb.net app , and I am creating and dropping temp tables. I just want to know whether the temp tables created programatically from some client app will get dropped automatically with dispose of application or we should have to drop it explicitly by code.

I need to be sure that all tables will get dropped when I close my app or that block has been executed successfully.

Right now I am dropping using drop table .... I need code to check existing temp table in sql server and drop them all at a time on form close.

I hope my lines are clear.

Environment is VB.Net + Sql Server 2008

+2  A: 

Local Temp tables are disposed of when the session closes.

Global temp tables (with ## prefix) are dropped off when the last connection using it closes.

no_one
You mean to i do not need to drop it explicitly. They will be itself dropped by the Sql Connection, when the session is called of. So it is safe to drop them after their usage and no need to further check whether they are dropped or not like in case of COM components.
Amit Ranjan
They will be dropped by SQL Server. Local temp tables are per session.
no_one