Enhance the Format SQL to recognize the WITH clause.
When the WITH clause is specified in the FROM clause on a JOIN, Format SQL pushes the join condition out to the WITH.
Like this:
FROM
TableA WITH (NOLOCK)
JOIN TableB WITH (NOLOCK)
ON TableA.ID = TableB.ID
I would like it to behave like it does when the WITH is not present
FROM
TableA WITH (NOLOCK)
JOIN TableB WITH (NOLOCK)
ON TableA.ID = TableB.ID
This is included in SQL Prompt 6.4, which you can download from http://www.red-gate.com/products/sql-development/sql-prompt/
-
Chattabaugh commented
I too am having issues with this. Mainly because it causes an inconstancy with the rest of the formatting. I did some test and the issue seems to be the parentheses and not the WITH clause. For example both "FROM table WITH (NOLOCK)" and "FROM table (NOLOCK)" aligns the ON clause with the first parentheses but "FROM table WITH NOLOCK" and "FROM table NOLOCK" align the on clause correctly. (unfortunately the latter examples are not valid)
-
William Soranno commented
the editor does not allow white space. so the example above look the same. In the first one the ON lines up with the ( of the WITH.
THe second one the ON lines up the space after the JOIN.