• bitbucket-25253 (11/23/2010)


    Want some more ...

    CREATE the temptable as ##

    Run the insert code ... do NOT close that instance of SSMS.

    Perform the SELECT * FROM ## statement .. right it returns the correct number of rows

    Open a second instance of SSMS

    Then perform ONLY the SELECT * FROM ## statement in this second instance of SSMS

    And yes, you do get the same number of rows returned, Intriguing indeed.

    Why intriguing? Table names starting with ## are considered to be global temporary tables. They're available to all sessions, and are only discarded when no sessions use them anymore.


    Hugo Kornelis, SQL Server/Data Platform MVP (2006-2016)
    Visit my SQL Server blog: https://sqlserverfast.com/blog/
    SQL Server Execution Plan Reference: https://sqlserverfast.com/epr/