Word Wrap settings not respected by BETWEEN
a.higgins
Posts: 90 Bronze 2
It seems that the "Characters per line" option is still affecting lines that include a BETWEEN statement, even when the "Wrap Text" option is unchecked.
The query below is set up to use some long character names. If I go to SQL Prompt - Options -> Format -> Styles -> Tabs & wrapping and choose "Wrap Text" and set the Characters per Line value to 60, it shows as follows: please notice that the second and third conditions in the WHERE clause are both wrapped.
If I uncheck "Wrap Text" and leave the Characters per Line value at 60, it shows the following: please note that the second condition is no longer wrapped, but the third condition is still wrapping to a new line.
If I go back in and change the Characters per Line value to 160, the code is shown as following: note that now none of the conditions are wrapped.
I've done some playing around, and the only thing I can find that consistently results uses the Characters per Line value, regardless of whether the Wrap Text box is checked, is a line of code that includes a BETWEEN keyword.
I'm running SQL Prompt 7.2.4.291 using Management Studio 2016 (13.0.15600.2)
The query below is set up to use some long character names. If I go to SQL Prompt - Options -> Format -> Styles -> Tabs & wrapping and choose "Wrap Text" and set the Characters per Line value to 60, it shows as follows: please notice that the second and third conditions in the WHERE clause are both wrapped.
; WITH CTE AS ( SELECT 0 AS SomeIntWithVeryLongName ) SELECT CTE.SomeIntWithVeryLongName FROM CTE WHERE 1 BETWEEN 0 AND 10 AND CTE.SomeIntWithVeryLongName >= CTE.SomeIntWithVeryLongName - 1000000 AND CTE.SomeIntWithVeryLongName BETWEEN CTE.SomeIntWithVeryLongName - 1 AND 90000000
If I uncheck "Wrap Text" and leave the Characters per Line value at 60, it shows the following: please note that the second condition is no longer wrapped, but the third condition is still wrapping to a new line.
; WITH CTE AS ( SELECT 0 AS SomeIntWithVeryLongName ) SELECT CTE.SomeIntWithVeryLongName FROM CTE WHERE 1 BETWEEN 0 AND 10 AND CTE.SomeIntWithVeryLongName >= CTE.SomeIntWithVeryLongName - 1000000 AND CTE.SomeIntWithVeryLongName BETWEEN CTE.SomeIntWithVeryLongName - 1 AND 90000000
If I go back in and change the Characters per Line value to 160, the code is shown as following: note that now none of the conditions are wrapped.
; WITH CTE AS ( SELECT 0 AS SomeIntWithVeryLongName ) SELECT CTE.SomeIntWithVeryLongName FROM CTE WHERE 1 BETWEEN 0 AND 10 AND CTE.SomeIntWithVeryLongName >= CTE.SomeIntWithVeryLongName - 1000000 AND CTE.SomeIntWithVeryLongName BETWEEN CTE.SomeIntWithVeryLongName - 1 AND 90000000
I've done some playing around, and the only thing I can find that consistently results uses the Characters per Line value, regardless of whether the Wrap Text box is checked, is a line of code that includes a BETWEEN keyword.
I'm running SQL Prompt 7.2.4.291 using Management Studio 2016 (13.0.15600.2)
Comments
Thanks for your post - we're currently working on an improved formatting system (which will be released in SQL Prompt 7.3, with a beta out very soon) and I can confirm that this bug doesn't exist in the new system.
Thanks,
Aaron.