SQL Server Transact Basic to Expert - Create a table variable

This blog shows how to create a table variable in sql server

Syntax:
DECLARE @TableName TABLE
   (columnname <data_type> [ NULL | NOT NULL ] [ ,...n ])


Example:
DECLARE @Empsal TABLE
( EmpID int NOT NULL PRIMARY KEY,
  Empsal money NOT NULL,
  EmpCount int NOT NULL)

Ebook Download
View all
Learn
View all