Xpode.com        Click here to Print this article.

What is the difference between temporary table and temporary variable

1.    Temporary Tables
Temporary tables are created in tempdb.
Create Table #Test (Id int, Name varchar(20))
If you need to create indexes on it then you must use a temporary table.
2.    Table Variable
These are similar to temporary tables except with more flexibility.
Declare @Test Table (Id int, Name varchar(20))
3.    Global Temporary Tables
Global temporary tables are visible to all SQL Server connections. When you create one of these, all the users can see it.
Create Table ##Test (Id int, Name varchar(20))

Contributed by:
Guest user is that user who have done some activity on website without login. Activity contains commenting on any article, uploading an image on website etc.

Resourse address on xpode.com

Click here to go on website