Using the following query,
WITH
cteTest (Employee_ID)
AS
(
SELECT employee_ID FROM pep.dbo.labor_ticket
)
SELECT Employee_ID FROM cteTest;
I get the following return:
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'WITH'.
Looks right to me. I asked a similar question about a subquery but the same logic does not apply here as I have aliased the table with the name cteTest. What's missing?