|
|
Archives of the TeradataForum
Message Posted: Tue, 19 Feb 2008 @ 17:58:32 GMT
Subj: | | Re: SQL to populate additional data |
|
From: | | Howard Bradley |
| Here is the problem that I did not realize previously: when using a derived table like this, select seems to be the only valid command.
It would not let me do an insert/select. | |
Michael
I have a query which Inserts the results from a recursive query into a table.
The syntax in this case would be :
Insert into mytable
with recursive temp (a2, b2,lvl) as
(sel product, max(cast(expanded_product as smallint)),0
from prod where product like '%X'
group by 1
union all
sel a2,b2+1,lvl+1 from temp where lvl < 9
)
sel a2,cast(b2 as char(4)) from temp where lvl > 0;
| |