Tuesday, February 3, 2015

Getting data from temorary table in SQL Server

use northwind
exec('select top 5 orderId, customerId into #temp from orders; select * from #temp')
select * from #temp 
drop table #temp 
The #temp table gets created and queried once as seen in results panel.
Then we have an error message in messages panel informing us:
Invalid object name '#temp'.

No comments:

Post a Comment