Inconsistent new line behavior with windowed function
a.higgins
Posts: 90 Bronze 2
I've noticed that the ORDER BY list items within a windowed function do not follow the normal "Place first item on new line" settings. The following query was formatted using the "If there are subsequent items" option:
;WITH CTE AS ( SELECT a = 1 ,b = 2 ,c = 3 ,x = 4 ,y = 5 ,z = 6 ) SELECT Field = ROW_NUMBER() OVER (PARTITION BY CTE.a ,CTE.b ,CTE.c ORDER BY CTE.x -- x ought to be on a new line ,CTE.y ,CTE.z ) FROM CTE ORDER BY CTE.x ,CTE.y ,CTE.zNote that, though each list item in the PARTITION BY and the final ORDER BY statements are on new lines, the first list value within the windowed function's ORDER BY is still on the original line.
Comments
You're right, the option for the first list item should be affecting ORDER BY in a windowed function, so we'll get this fixed for the next release.
Best regards,
David
We have put in a fix for this in the latest beta release.
Please let us know if this solves your problem.
Best regards,
David