Thursday, June 20, 2013

What is the difference between Local and Global temporary table in SQL-server?

Posted by Rahul Kharde at 4:10 AM

Local temporary table
Global temporary table
Denoted by # symbol.
Denoted by ## symbol.
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.
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.
Tables are visible only in the current session
Tables are visible to all sessions.
Cannot be shared between multiple users.
Can be shared between multiple users.


Local Temporary table


Global Temporary table

SELECT * FROM ##temp

If you enjoyed this post and wish to be informed whenever a new post is published, then make sure you subscribe to my regular Email Updates. Subscribe Now!

Kindly Bookmark and Share it:



Have any question? Feel Free To Post Below:


Popular Posts

Recent Comments

© 2011. All Rights Reserved | Help to understand .Net | Template by Blogger Widgets

Home | About | Top