A small free .Net and JS library (with demo UI, command-line bulk formatter, SSMS/VS add-in, notepad++ plugin, winmerge plugin, and demo webpage) for reformatting and coloring T-SQL code to the user's preferences.
This following formatted case statement is difficult to read. May I suggest that function parameters have their own lines when the parameter list gets "too long", and all the CASE clauses align vertically.
Instead of outputting
(
CASE
WHEN (("v.$string") IS NULL)
OR (("v.$string") = '')
THEN NULL
ELSE SUBSTR("v.$string", CASE
WHEN ((1) IS NULL)
OR ((max(0, min(LENGTH("v.$string"), (LENGTH("v.$string")) - (4)))) IS NULL)
THEN NULL
ELSE (1) + (max(0, min(LENGTH("v.$string"), (LENGTH("v.$string")) - (4))))
END, (LENGTH("v.$string")) - (max(0, min(LENGTH("v.$string"), (LENGTH("v.$string")) - (4)))))
END
) = ('test')
ensure multi-line CASE statements have the clauses aligned,
(
CASE
WHEN (("v.$string") IS NULL) OR (("v.$string") = '')
THEN NULL
ELSE
SUBSTR(
"v.$string"
,CASE
WHEN ((1) IS NULL) OR ((max(0, min(LENGTH("v.$string"), (LENGTH("v.$string")) - (4)))) IS NULL)
THEN NULL
ELSE (1) + (max(0, min(LENGTH("v.$string"), (LENGTH("v.$string")) - (4))))
END
,(LENGTH("v.$string")) - (max(0, min(LENGTH("v.$string"), (LENGTH("v.$string")) - (4))))
)
END
) = ('test')
This following formatted
case
statement is difficult to read. May I suggest that function parameters have their own lines when the parameter list gets "too long", and all theCASE
clauses align vertically.Instead of outputting
ensure multi-line CASE statements have the clauses aligned,
thank you