Thursday, May 31, 2012

What are the types of temporary tables and where are they stored in SQL Server ?

There are two types of temporary tables:
  • Local temporary tables:
    • Only available to the current connection to the database for the current login
    • They are dropped when the connection is closed
  • Global temporary tables:
    • Available to any connection upon their creation
    • They are dropped when the last connection using them is closed  
     
Local Temporary Table CREATE TABLE #table_name (
    column_name [DATATYPE] )
 

Global Temporary Table CREATE TABLE ##table_name (
column_name
[DATATYPE] )

No comments:

Post a Comment