• vk-kirov (11/22/2010)


    Carlo Romagnano (11/22/2010)


    Also this is wrong:

    If you used a query like this, you would see your table:

    You will see ALL tables that begins with '#testvm', also, tables belonging to other sessions.

    ... only if you are a privileged user on the server (a member of the sysadmin role, I assume). If you are an ordinary user, you can see only the temporary tables which have been created in your current connection.

    Any user can view sysobjects in tempdb:

    Open session ONE:

    create table #a(i int)

    select name,id from tempdb.dbo.sysobjects where name like '#a%'

    Open session TWO with same or another user:

    create table #a(i int)

    select name,id from tempdb.dbo.sysobjects where name like '#a%'

    Here the result:

    nameid

    #a__________________________________________________________________________________________________________________0000000A683186071260

    #a__________________________________________________________________________________________________________________0000000A6855955646365