I want to create VIEW using WITH clauses, but really can't find any references on correct syntax.
I want smth like this
WITH TempTbl AS (SELECT ...)
CREATE VIEW SomeView
SELECT *
FROM TempTbl
And what is the correct syntax for using several WITH clauses?
Nothing useful on MSDN 🙁
Best Answer
The CTE goes inside the view.
Take a query with a CTE
Just add CREATE VIEW AS .. GO
MSDN does describe multiple CTEs (See example j)