Format SQL Code has problem with condition wrapping
Posted: Tue 10 Nov 2015 18:19
Multiple conditions in WHERE clauses and ON clauses in JOINs do not honor the settings using the online tool. Here is the code I used, unformatted:
In the SELECT / WHERE / Wrap Condition options, I have checked After logical operator / Any operator. The Before logical operator section is unchecked.
The following is what results after pressing FORMAT. Please note the WHERE condition.
What I *want* to see is this:
I have tried several different WHERE clause examples from our code base which use multiple conditions of varying complexity, but they all act like Before logical operator / Any operator is checked, instead of After logical operator / Any operator.
I need this kind of formatting also with the ON clauses in my JOIN queries as some of our scripts are very complex and difficult to read.
So, have I made the correct settings to do this, or is there truly an issue with the formatter?
Code: Select all
declare
@Cycle int = 42;
BEGIN
SELECT FI.this, FI.that
, RI.SomethingElse / FIT.ADivisor,
fi.MoreData
from FInvoice FI left join RInfo RI on RI.id = FI.fi_id
and RI.ACode = FI.ACode
join FITypes FIT on FIT.ACode = FI.ACode and FIT.TypeCode = FI.TypeCode
where (FI.CountryISOCode in ('ABC'))
or (FIT.VAT_Split = 1)
and Cycle = @Cycle
;
END
The following is what results after pressing FORMAT. Please note the WHERE condition.
Code: Select all
declare
@Cycle int = 42;
begin
select
FI.this,
FI.that,
RI.SomethingElse / FIT.ADivisor,
fi.MoreData
from
FInvoice FI
left join RInfo RI
on RI.id = FI.fi_id
and RI.ACode = FI.ACode
join FITypes FIT
on FIT.ACode = FI.ACode
and FIT.TypeCode = FI.TypeCode
where
(FI.CountryISOCode in ('ABC'))
or (FIT.VAT_Split = 1)
and Cycle = @Cycle
;
end
Code: Select all
where
(FI.CountryISOCode in ('ABC')) or
(FIT.VAT_Split = 1) and
Cycle = @Cycle
I need this kind of formatting also with the ON clauses in my JOIN queries as some of our scripts are very complex and difficult to read.
So, have I made the correct settings to do this, or is there truly an issue with the formatter?