Link to home
Start Free TrialLog in
Avatar of jvalescu
jvalescuFlag for United States of America

asked on

How can I create a temp table and insert data from a query easily?

I'd like to insert data from a query into a temp table in the simplest manner.  I've looked at INSERT INTO SELECT, but it looks like the source data has to be from a table.  There's got to be a way to do this without cursors, right?  Thanks!
ASKER CERTIFIED SOLUTION
Avatar of Patrick Matthews
Patrick Matthews
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of jvalescu

ASKER

Thanks!
>but it looks like the source data has to be from a table.

Not true.  the query will act just like a table:

Select * into #temp_table
from (select ... your query goes here)