All Forums Database
astocks 22 posts Joined 03/11
23 Apr 2015
Insert from WITH variation of Derived Table

I'm trying to INSERT INTO a table or CREATE TABLE AS from a SQL statement using the WITH form of a derived table.  Is this possible?

Pass6(n) as (select 1 from Pass5 as a cross join Pass3 as b),
Pass5(n) as (select 1 from Pass4 as a cross join Pass4 as b),
Pass4(n) as (select 1 from Pass3 as a cross join Pass3 as b),
Pass3(n) as (select 1 from Pass2 as a cross join Pass2 as b),
Pass2(n) as (select 1 from Pass1 as a cross join Pass1 as b),
Pass1(n) as (select 1 from Base1 Union all select 1 from Base2),
Base1(n) as (select 1),
Base2(n) as (select 1)
select row_number() OVER (order by 1) as n from pass6)


You must sign in to leave a comment.