Microsoft introduced table variables with SQL Server 2000 as an alternative to using temporary tables.The SQL Table variable is used to create, modify, rename, copy and delete tables.

Table variables are used to store a set of records. So declaration syntax generally looks like CREATE TABLE syntax.


create table "tablename" 

("column1" "data type", 

"column2" "data type", 

... 

"columnN" "data type"); 



				

A table variable generally uses lesser resources than a temporary variable.Table variable cannot be used as an input or an output parameter.