Temporary Table
Temporary table is same as the table, it creates the dummy
table on the database
Ttemp table is available whem the connection is live or the
session is live.
Once the session is expired the temporary table is deleted.
Temporary table are created at runtime
There are two types of temp table
1) local
temporary table
2) global
temporary table
Local temp tables are only available to the current
connection for the user; and they are automatically deleted when the user
disconnects from instances. Local temporary table name is stared with
hash ("#") sign.
Global Temporary tables name starts with a double hash
("##"). Once this table has been created by a connection, like a
permanent table it is then available to any user by any connection. It can only
be deleted once all connections have been closed.
Temporary tables are stored at Temp DB database
select * into
#EmployeesTempTable from Employees
--or
create table #EmpTemp
(id int,
name varchar(20))
--or
create table ##EmpTemp
(id int,
name varchar(20))
drop table ##EmpTemp
