Temp variable can be created like this:
1 2 3 4 5 6 7 8 9 10 11 |
DECLARE @temp_tblEmployee TABLE ( [Emp_ID] [int] NOT NULL, [Emp_Name] [varchar](max) NOT NULL ) INSERT INTO @temp_tblEmployee SELECT 1,'Shashangka Shekhar' SELECT * FROM @temp_tblEmployee 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.
Post a comment