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)
 SELECT [Identity] as Id, SecurityID FROM [Ids_staging].dbo.[StageJPMorganValuationReport] WHERE batchId = 38969

SELECT * FROM MyDataCTE  /// Without this line here, you get this error.


Popular posts from this blog

ionic2 cordova build android - Unable resolve gradle 2.2.3

A quick tutorial for OWASP ZAP tool for beginners

OpenCover code coverage for .Net Core