Table Variables

1. Table variables are similar to the normal tables or temporary tables.

2. This is good if you don’t want to store large data for temporary use.

3. These are only available during the execution of the program.

4. The Syntax is as follows
DECLARE @< Variable_Name > TABLE >(< ColumnName1 > < Datatype >,< ColumnName2 > < Datatype >…)

5. The below shows the example to use table variables

DECLARE @temp_employee TABLE(EmployeeID int PRIMARY KEY,
FirstName varchar(50),
LastName varchar(50),
Sex char(1),
Age int DEFAULT 18,
DateOfBirth DateTime)

SELECT * FROM @temp_employee

Comments

Popular posts from this blog

Jesus - God Thinks of you.

ASP.NET 4.0 Feature - URL Routing

Tips on JQuery Intellisense in VS 2008