How to insert recursive query answerset to another table

Database

How to insert recursive query answerset to another table

Hi,

For a looping concept, i had done a query in recursive but i dont know how to load the result to another table,

I need your help to load the answerset to another table.

Thanks

5 REPLIES
N/A

Re: How to insert recursive query answerset to another table

insert into target
with recursive cte as
(select ...)
select * from cte

Dieter

Re: How to insert recursive query answerset to another table

Thanks Dieter.

Re: How to insert recursive query answerset to another table

WHAT IS THE TARGET TABLE HERE..IF WE WANT TO INSERT SPECIFIC COLUMN HOW DO WE DO IT?

Re: How to insert recursive query answerset to another table

All the columns selected at the end of recursive query are inserted in the table. If you want to insert some specific columns then select only those ones.

Re: How to insert recursive query answerset to another table

We were just saying the other day that when you find an answer from Dieter you know you've got something that will work. After a half-hour of trying to figure out the problem with my first INSERT INTO with a CTE I found this lovely concise example and now have data in my table. Thanks again.