我的目标是在同一个存储过程中从一个CTE中选择结果,并将其插入到另一个带有不同CTE的表中。怎么做?
我的错误是...
无效的对象名称xy。
我的查询语句是:
WITH ds
(
Select a, b, c
from test1
),
xy
(
select d, e, f
from test2
where (uses conditions from ds)
)
Select *
from ds (the result set of ds, am exporting this to csv)
Insert into AuditTest
(
Select * from xy
)
SELECT
,作为语句的一部分定义了两个CTE。)要使第二个语句使用CTE,这些将需要包含在第二个语句中。 - spencer7593