Competition: What’s your favorite Redgate tool? Enter now.
Inconsistent new line behavior with windowed function
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.
0 · Share on Twitter