Drop a temp table

Well folks we know that temp tables are closed when the user closes his/her session. In fact, BOL explicitly states :

“Local temporary tables are visible only to their creators during the same connection to an instance of SQL Server as when the tables were first created or referenced. Local temporary tables are deleted after the user disconnects from the instance of SQL Server.”

Now here is the problem. One of our users complained that he had disconnected from SQL Server. When he came back, the temp table that he had created was still present. It was preventing him from running a query successfully.

Note that though he disconnected from the instance and then re-connected, the temp table was still present.

We could see that his sessions were still active in many databases. After getting his permission, we proceeded to close all his sessions.

As expected, it dropped the temp table also.

Hope this helps!

This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s