What is the differences between local and global temporary tables in sql server?

Total Post:23

Points:115

 1285  View(s)
Ratings:
Rate this:
  1. What is the differences between local and global temporary tables in sql server?

    Global Temp Variable:
    Global temp tables name starts with double hash (##) in sql server. Once this table is created in database, it is like a permanent table in tempdb->temporary tables. It is always ready for all users and not deleted until the total connection is withdrawn.

    CREATE TABLE ##StudentTemp
     (  
    Username varchar(50),  
    User_address varchar(150)
    Local Temp Variable:
    Local temp tables are only available at current connection time in sql server database. It is automatically deleted when user disconnects from instances. It is started with hash (#) sign.

    CREATE TABLE #localTemp
     (  
    Username varchar(50),  
    User_address varchar(150)

      Modified On Mar-28-2018 06:14:20 AM

Answer