Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Query from multiple CTE's

$
0
0

Can I do something like this

DECLARE @vals TABLE
    (
        tblid INT IDENTITY(1, 1),
        val1 NVARCHAR(40),
        val2 NVARCHAR(40)
     );



WITH MyCTE1
AS
(
  SELECT top 10....
)

WITH MyCTE2
AS
(
   SELECT top 10 ...
)

INSERT  INTO @vals (val1,val2)
VALUES (SELECT * FROM MyCTE1, SELECT * FROM MyCTE2)  


Viewing all articles
Browse latest Browse all 23857

Trending Articles