Answers:
CTE进入视图内。
通过CTE进行查询
WITH cte AS (...) SELECT ...;
只需添加CREATE VIEW AS .. GO
CREATE VIEW
AS
WITH cte AS (...) SELECT ...;
GO
MSDN确实描述了多个CTE(请参见示例j)
CREATE VIEW
AS
WITH
cte1 AS (...),
cte2 AS (...),
cte3 AS (...)
SELECT ...
GO
CREATE VIEW
someview
AS
WITH CTEstuff AS (SELECT etc)
SELECT * FROM CTESTuff;
create view myView as ( select ... )
可以,create view myView as with tempTbl as select ...
但是create view myView as ( with tempTbl as select ... )
是语法错误。`