IamCalvinBrown.com a Blog Site

Code Examples, Consulting Advice and lots of other cool things

Creating a Table Variable in SQL



Table variables are excellent for the temporary needs of SQL developers to create a structure (in memory) and select data just as you would from a real table.

Declare @MyTableVar TABLE

(

uniqueRowID   INT IDENTITY(1,1) PRIMARY KEY,

first_name    VARCHAR(35),

last_name   VARCHAR(35)

)

Loading