Friday, September 13, 2013

Filled Under:
,

Difference between Local Temp Table and Global Temp Table ?

What is the difference between Local Temp Table and Global Temp Table ?

Temporary tables are temporary storage structures.
You may use temporary tables to store data that you
will manipulate before arriving at a final format. 
 
Local Temp Table: 
The hash (#) character (prefix with tablename) is used to declare a temporary table 
as it is prepended to the table name. A single hash (#) specifies a local temporary table.
 Local temporary tables are available to the current connection for the user, so they 
disappear when the user disconnects. Within SQL Server, temporary tables are stored 
in the Temporary Tables folder of the tempdb database.
Syntax for creating Local Temp Table
Create table #tempLocalTableName(EmpId int, EmpName varchar(50), EmpAdd varchar(100))

Global Temp Table:
Global temporary tables may be created with double hashes (##) (Prefix with table name).
 These are available to all users via all connections, and they are deleted only when all
 connections are closed. Once created, these tables are used just like permanent tables;
 they should be deleted when you are finished with them. 
Syntax for creating Temp Table
Create table ##tempGlobalTableName(EmpId int, EmpName varchar(50), EmpAdd varchar(100))




If you like this post share it.. If you encounter any problems, feel free and

comment below to find solution. Share Your Experience with us.

 





1 comments:

  1. " Thanks for one marvelous posting! I enjoyed reading it; you are a great author. I will make sure to bookmark your blog and may come back someday. I want to encourage that you continue your great posts, have a nice weekend!
    "
    Authorized ipad service center in Chennai | Authorized ipod service center in Chennai | ipad service center in chennai | ipod service center in chennai | ipad service center in chennai

    ReplyDelete