Friday, October 16, 2009

How to Insert data into a temporary table with the help of SQL stored procedure

This Stored Procedure shows how to create temporary table and insert data into it from another table
Create procedure sp_tempTable
create table #tempTable(ID int,Symbol nvarchar(50)) -- Create #tempTable
insert into #tempTable
select Max(ID) as MaxId,Symbol from Sheet1 Group by Symbol --Insert data from - --Sheet1 table
select * from #tempTable
drop table #tempTable
--To execute
--exec sp_tempTable

No comments:

Post a Comment