On 22 Feb 2005 23:04:52 -0800, wrote:
>
>If exists(Select name from sysobjects where name='#t1')
> --Table #t1 exists
>else
> --Table #t1 doesn't exist
>
>
>Madhivanan
Yes, the query should be exactlyt:
if exists(select * from tempdb..sysobjects where name like '#t1%')
..
..
but such query cannot be used for this purpose: while one session
creates a #t1 table and then other session performs such query
without creating is's own #t1 table, the result is allways more
than 0 rows.
Somewhere on server resides a relationship between a record of
tempdb..sysobject with name like '#t1%' and the user session. I tried
to recover such relationship, but (so far) I was unsuccessfull.
Libor
>> Stay informed about: Detecting an existence of local temporary table