SQL not formatted in CTE
JimF
Posts: 49 Bronze 3
Hello,
This is a minor issue, but if you have a multiline comment in a CTE, the first line of T-SQL is put next to the close of the comment instead of on the next line. See sample below.
Thank you,
Jim
This is a minor issue, but if you have a multiline comment in a CTE, the first line of T-SQL is put next to the close of the comment instead of on the next line. See sample below.
Thank you,
Jim
USE AdventureWorks ; GO WITH DirReps(ManagerID, DirectReports) AS ( /* * Test comment */SELECT ManagerID, COUNT(*) FROM HumanResources.Employee AS e WHERE ManagerID IS NOT NULL GROUP BY ManagerID ) SELECT ManagerID, DirectReports FROM DirReps ORDER BY ManagerID ; GO
Comments
I have been able to reproduce the issue using your example. It seems that in a CTE, a comment block before a SELECT or AS statement will not be displayed on a different line.
I have added a record of this in our bug tracking system. (SR-780)
Once approved, a fix will be scheduled into a future version.