TSQL Common table expression getting incorrect syntax near )
This message is really not helpful at all.
Say if you create a common table expression that does not immediate follow by a query, you get this nice error, for example :-
WITH MyDataCTE (Id, SecurityID)
AS
(
SELECT [Identity] as Id, SecurityID FROM [Ids_staging].dbo.[StageJPMorganValuationReport] WHERE batchId = 38969
)
SELECT * FROM MyDataCTE /// Without this line here, you get this error.
Comments