What are Temporary tables?
Temporary tables are very similar to the permanent tables. Permanent tables get created in the database you specify , abd remain in the database permanently, until you delete or drop them.
On the other hand , temporary tables get created in the TempDB and are automatically deleted , when they are no longer used.
Temporary tables are particularly useful when you have a large number of records in a table and you repeatedly need to interact with a small subset of those records. In such cases instead of filtering the data again and again to fetch the subset, you can filter the data once and store it in a temporary table. You can then execute your queries on that temporary table. Temporary tables are stored inside “tempdb” which is a system database. Let’s take a look at how you can use a temporary data in a simple scenario.
Types Of Temporary tables
1. Local Temporary Tables
2. Global Temporary Tables
First we need to understand what are the permanent tables.
Permanent tables are those tables that we created by using Create table tableName Command.
We can see permanent tables by expanding database and inside tables like

Lalit RaghuvanshiPosted Feb 2, 2015, 11:30 AM
There is another good detailed example on:Sql server Temporary tables, their types, use with examples and important points http://www.webcodeexpert.com/2015/01/example-to-create-and-use-temporary_31.html
Harshal VadnerePosted Jun 12, 2013, 3:33 AM
nice post and it is very informative
Jack OwensPosted May 13, 2013, 1:00 PM
Mahesh, thanks for the article. It is informational, but I think following 3 point may need to be addressed differently 1) Temporary Table in SQL Server --The number of rows and columns needs to be as small as needed --Tables need to be deleted when they are done with their work 2) When to Use Temporary Tables? --This is useful to replace the cursor