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

Solving Sonarqube :- Project was never analyzed. A regular analysis is required before a branch analysis

spark - pyspark reading from excel files