Table Variables

Temp variable can be created like this:

DECLARE e TABLE 
(
        [Emp_ID] [int] NOT NULL,
        [Emp_Name] [varchar](max) NOT NULL
)
INSERT INTO e
SELECT 1,'Shashangka Shekhar'

SELECT * FROM e

GO

Table variable is always useful for less data. If the result set returns a large number of records, we need to go for temp table.

Author:

Since March 2011, have 8+ years of professional experience on software development, currently working as Senior Software Engineer at s3 Innovate Pte Ltd.

Leave a Reply