posted on Wednesday, November 09, 2005 8:03 AM by SimonSabin

Check for existence of temporary table

My blog has moved to sqlblogcasts.com/blogs/simons
The full version of this post can be found here., http://sqlblogcasts.com/blogs/simons/Check for existence of temporary table
The new RSS feed is here

Another of those tricks that isn't well documented is the ability to check for the existence of a temporary table.

Many places say it's not possible for #tables, well they're wrong.

... To read the complete version of this post go here, http://sqlblogcasts.com/blogs/simons/Check for existence of temporary table

Comments

# re: Check for existence of temporary table @ Thursday, November 17, 2005 4:09 PM

Thanks! I try to use table variables whenever possible to avoid those annoying RS errors about tables not existing. However in the case of doing dynamic SQL you are forced to use temp tables to pass data back and forth.

Andy S.
andymcdba1@nospam.yahoo.com

<Remove nospam before replying>

Andy S.

# re: Check for existence of temporary table @ Tuesday, February 28, 2006 8:14 PM

Thanks! this is probably the only place where it would tell anyone how to detect #tables

kublai

# re: Check for existence of temporary table @ Tuesday, February 28, 2006 8:14 PM

Thanks! this is probably the only place where it would tell anyone how to detect #tables

kublai

# re: Check for existence of temporary table @ Monday, September 25, 2006 2:11 PM

This worked great. It even distinguishs between multiple instances of the local temp table based on multiple connections.

Neal A.

# re: Check for existence of temporary table @ Thursday, December 14, 2006 4:43 AM

Thanx a lot, dude.

p

Peter

# Thanks @ Friday, January 05, 2007 11:12 AM

Thanks, it helped

Tom

# re: Check for existence of temporary table @ Tuesday, January 23, 2007 6:28 AM

very useful code.
thanks.

Santosh G Tembhare

# re: Check for existence of temporary table @ Friday, February 02, 2007 11:34 AM

very helpful piece of code..

Deepali Chikkam