Click here to Skip to main content
15,908,909 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi All,

i want to capture all values in a variable from a select statement(i.e like Select * from Employee) and that captured values is later being used in another query.
i have tried a lot but i am not getting as per my requirement..
so, pls help, if any one has solution..

thanks,
Raj
Posted
Comments
ZurdoDev 21-Nov-12 7:37am    
You can create a variable of type table. A quick google search shows this as an example, http://www.sqlteam.com/article/using-table-variables

1 solution

Hi Raj,

As per your requirement you can use Table variable or Temporary table for Storing Output Data .

Eg :

SQL
Select * into #temp from Employee


Above Query Create Temporary table #temp and Stores output from Employee into #temp table

Now when you want to use stored data, you can just write select Query as :


SQL
Select * from #temp



Cheers !
Yogendra Dubey
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900