Communities for your favorite technologies. Explore all Collectives
Stack Overflow for Teams is now called Stack Internal. Bring the best of human thought and AI automation together at your work.
Bring the best of human thought and AI automation together at your work. Learn more
Find centralized, trusted content and collaborate around the technologies you use most.
Stack Internal
Knowledge at work
Bring the best of human thought and AI automation together at your work.
This does not compile in SQL server 2012:
with q as ( select row_number() over (order by ActionName) as rn, * from [xxx].[dbo].[Action] a )
It says 'Incorrect syntax near the keyword 'as'.
Should this compile and if not how to fix this?
start your statement with ; try this
;
;with q as ( select row_number() over (order by ActionName) as rn, * from [xxx].[dbo].[Action] a ) SELECT * FROM q
and CTE should be followed by a SELECT statement.
Add a comment
;with q as ( select row_number() over (order by a.ActionName) as rn, a.* from [xxx].[dbo].[Action] a )
with q as ( select *, row_number() over (order by ActionName) as rn from [xxx].[dbo].[Action] a )
Required, but never shown
By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.
Start asking to get answers
Find the answer to your question by asking.
Explore related questions
See similar questions with these tags.