WHAT IS THE DIFFERENCES BETWEEN LOCAL AND GLOBAL TEMPORARY TABLES IN SQL SERVER?

Anupam Mishra

Total Post:23

Points:115
Posted by  Anupam Mishra
 668  View(s)
Ratings:
Rate this:
  1. Anupam Mishra

    Post:23

    Points:115
    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)

Answer

NEWSLETTER

Enter your email address here always to be updated. We promise not to spam!