mbova407 (11/22/2010)
Correct sql is
select * from tempdb..sysobjects where name like '%#testvm%'
Not quite.
It was mentioned in an earlier post that using LIKE and wildcards may return more than one record if another temporary table is created with a similar name.
And in another post using the built-in function OBJECT_ID was proposed.
Then Hugo brought up the fact that sysobjects is deprecated and sys.objects shouild be used instead.
So putting all this together we have:
select * from tempdb.sys.objects where object_id = OBJECT_ID('tempdb.dbo.#testvm')
Hope I've not missed anything 🙂