Alternative of Temporary table is the Table variable which can do all kinds of operations that we can perform in Temptable. Below is the syntax for using Table variable.
Declare @TempTableVariable TABLE(
UserID int,
UserName varchar(50),
UserAddress varchar(150))
The below scripts are used to insert and read the records for Tablevariables:
insert into @TempTableVariable values ( 1, 'Abhijit','India');
Now select records from that tablevariable:
select * from @TempTableVariable
Declare @TempTableVariable TABLE(
UserID int,
UserName varchar(50),
UserAddress varchar(150))
The below scripts are used to insert and read the records for Tablevariables:
insert into @TempTableVariable values ( 1, 'Abhijit','India');
Now select records from that tablevariable:
select * from @TempTableVariable
No comments :
Post a Comment