Naresh Beniwal
Differences between local and global temporary tables?

What are the differences between local and global temporary tables?

By Naresh Beniwal in SQL Server on Nov 08 2019
  • Abhishek Addu
    Aug, 2021 30

    Local temporary table

    1.Local temporary tables are visible only to their creators during the same connection to an instance of SQL Server as when the tables were first created or referenced. Local temporary tables are deleted after the user disconnects from the instance of SQL Server.

    2.Tables are visible only in the current session

    3.Cannot be shared between multiple users.

    Example
    SELECT * FROM #temp

    Global temporary table

    1.Global temporary tables are visible to any user and any connection after they are created, and are deleted when all users that are referencing the table disconnect from the instance of SQL Server.

    2.ables are visible to all sessions.

    3.Can be shared between multiple users.

    Example
    SELECT * FROM ##temp

    • 1


Most Popular Job Functions


MOST LIKED QUESTIONS