Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Difference between permanent and temporary table

Author  Topic 

Dipu710646
Starting Member

10 Posts

Posted - 2010-11-22 : 09:44:04
Hi Guys,

What is the diffrence between permanent and temporary table in SQL Server ?

Please answer. It is very urgent..

Dipankar Sana

TimSman
Posting Yak Master

127 Posts

Posted - 2010-11-22 : 09:45:38
One is permanent, the other is not.
Go to Top of Page

nigelrivett
Master Smack Fu Yak Hacker

3385 Posts

Posted - 2010-11-22 : 09:54:45
A temp table (with a single #) is held in tempdb and is only available to the connection (spid) that created it. It will be automatically dropped when that spid or the creating batch ends.
If two temp tables of the same name are created on the same connection the latest one created takes precedence until it goes out of scope.

A global temp table (##) is avaiable across connections.

A permanent table should be a static structure and available to all connections with permission.

==========================================
Cursors are useful if you don't know sql.
SSIS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -