johnwalker10 (7/7/2016)
select left(name, charindex('_',name)-1)
from tempdb..sysobjects
where charindex('_',name) > 0 and
xtype = 'u' and not object_id('tempdb..'+name) is null
Thanks, and if I would like to know the top 10 temp tables and the number, how can I do it?