SQL Formatter Options
Options
Stored Proc Conditions
The IF and Conditions Options in the SQL Formatter Tool allow you to customize the formatting of conditional statements (IF
, THEN
, ELSE
) and related constructs. These settings ensure that conditions are formatted clearly and consistently, enhancing readability and maintainability.
IF and THEN/ELSE Formatting
IF
- Adds a line break before or after the
IF
keyword to structure conditional statements.
- Adds a line break before or after the
THEN
- Adds a line break before or after the
THEN
keyword for better separation. - Indent THEN: Indents the
THEN
block to align it hierarchically with theIF
statement.
- Adds a line break before or after the
After ELSE
- Adds a line break after the
ELSE
keyword to clearly separate it from subsequent content. - Indent ELSE: Indents the
ELSE
block for better visual structure.
- Adds a line break after the
Conditions
Open „(“ / Close „)“
- Open „(„: Adds a line break before the opening parenthesis in conditions.
- Close „)“: Adds a line break after the closing parenthesis for improved readability.
AND/OR
- Adds a line break before logical operators (
AND
/OR
) in conditional statements for clarity.
- Adds a line break before logical operators (
Indent Conditions in Brackets
- Indents conditions enclosed within parentheses to align them with the surrounding structure.
Align Compare Operators (<, >, =, …)
- Aligns comparison operators (e.g.,
<
,>
,=
) to create a clean and visually consistent layout.
- Aligns comparison operators (e.g.,
BEGIN/END
- Indent BEGIN … END
- Indents the
BEGIN
andEND
blocks to reflect the nested structure of procedural SQL. - This ensures that all statements within the block are visually grouped.
- Indents the
How to Use These Settings
Enable Line Breaks for Keywords
- Use the checkboxes for IF, THEN, and ELSE to define where line breaks are added around these keywords.
Customize Indentation
- Enable Indent THEN and Indent ELSE to structure the blocks for hierarchical alignment.
- Use Indent Conditions in Brackets to format conditions neatly within parentheses.
Control Parenthesis and Logical Operators
- Use Open „(„ and Close „)“ to separate parenthesis-enclosed conditions.
- Add line breaks with AND/OR to clearly distinguish logical conditions.
Align Operators
- Enable Align Compare Operators (<, >, =, …) to create visually consistent conditional statements.
Indent BEGIN/END Blocks
- Use the Indent BEGIN … END option to ensure procedural blocks are aligned and easy to follow.
Tips for Optimal Usage
- Use Indent THEN and Indent ELSE for a clear hierarchical structure in conditional statements.
- Enable Align Compare Operators to ensure conditions are easy to read, especially in complex queries.
- Add line breaks with AND/OR to separate logical operators and improve readability.
- Indent BEGIN … END blocks to reflect their nested nature and maintain clarity in procedural SQL.