programplug Logo



SQL Table Variable

Table Variable In SQL


The Table variable in SQL is used to create, rectify, rename, copy and remove tables. Table variable was intvented by Microsoft.The SQL server 2000 was introduced to be alternative in temporary tables.
In variable we store the result and records in temporary.

CREATE TABLE "table_name"
CREATE TABLE "table_name"
("coloumnX" "table_1"
"coloumnY" "table_2"
....
"coloumnN" "table_3");
				

Table variable never be used as input or output parameter.
Once the transaction is rolled back the data associated with table is never rolled back again.