I have to create a temp table (#temp) from a variable or stored procedure
(i.e)
My stored procedure contains
......
set @sql='select ...'
set @sql=@sql+'..join..'
set @sql=@sql+'....join..'
when i execute it (i.e) exec (@sql)
it returns some rows,i want to store that rows
in a temp table.How to acheieve it?
i tried something like
select
id,name,ward_no into,........
#temp
from
(
exec (@sql)
)derived
Update
I found the logic
(i.e)
create table #temp(....)
insert #temp exec(@sql)
select * from #temp