Alan,
You can use OBJECT_ID() function
IF OBJECT_ID('tempdb..#mytemptable')IS NOT Null
DROP TABLE mytemptable
A local temporary table is only visible to the the current session and will be droped at the end of the session. However if it's created in a stored procedure/trigger than it'll be droped as soon as stored procedure/trigger completes. For more details see
Temporary Tables section in the
CREATE TABLE topic in BOL.
>In the T-SQL window I have created some temporary tables using the syntax
>
>SELECT * INTO #MyTempTable FROM MyTable.
>
>Where can I find what temporary tables are currently available (I don't want to delete them yet using DROP TABLE ...)? I cannot find them in any enterprise mgr. table listing. Is it stored in memory like a VFP temporary cursor? What is the scope of these 'tables'? Are they present until the SQL session finishes?
>
>
--sb--