SQL Formatter Options
Options
CASE
The CASE Options in the SQL Formatter Tool allow you to format CASE statements with precision, ensuring better readability and alignment with coding standards. These settings control indentation, line breaks, and compactness for both simple and complex CASE structures.
CASE Formatting
CASE, WHEN, THEN, ELSE, END
- Adds line breaks before these keywords in the
CASEstatement for better clarity and structure. - These options ensure each component of the
CASEblock is properly separated.
- Adds line breaks before these keywords in the
Indent CASE inside „()“
- Indents the entire
CASEblock when it is enclosed within parentheses.
- Indents the entire
Indent WHEN, THEN, ELSE
- Adds indentation to the
WHEN,THEN, andELSEkeywords for hierarchical alignment in nested or multi-lineCASEstatements.
- Adds indentation to the
CASE Condition
AND/OR
- Adds a line break before logical operators (
AND,OR) within theCASEconditions to clearly separate them from other conditions.
- Adds a line break before logical operators (
Open „(“ / Close „)“
- Open „(„: Adds a line break before the opening parenthesis in
CASEconditions. - Close „)“: Adds a line break after the closing parenthesis for better visibility of nested conditions.
- Open „(„: Adds a line break before the opening parenthesis in
Small CASE Statements on 1 Line
- No Break for CASE < X chars
- Keeps small
CASEstatements (e.g., under 10 characters) on a single line for compactness. - Adjust the character limit using the
-10and+10buttons to define what qualifies as a „small“CASEstatement.
- Keeps small
Compact vs. Expand
- Compact: Condenses
CASEstatements by reducing line breaks and indentation. - Expand: Formats
CASEstatements with more line breaks and indentation for improved readability.
How to Use These Settings
Enable or Disable Line Breaks
- Use the checkboxes for CASE, WHEN, THEN, ELSE, END to specify where line breaks should be added in
CASEblocks.
- Use the checkboxes for CASE, WHEN, THEN, ELSE, END to specify where line breaks should be added in
Customize Indentation
- Enable indentation options like Indent CASE inside „()“ and Indent WHEN, THEN, ELSE to align keywords hierarchically within the
CASEblock.
- Enable indentation options like Indent CASE inside „()“ and Indent WHEN, THEN, ELSE to align keywords hierarchically within the
Adjust Logical Conditions
- Use the AND/OR option to structure complex conditions within
CASEstatements with line breaks and proper alignment.
- Use the AND/OR option to structure complex conditions within
Set Character Limits for Compactness
- Define a character limit for keeping small
CASEstatements on one line to maintain a balance between compactness and readability.
- Define a character limit for keeping small
Switch Between Compact and Expand Modes
- Use Compact for minimizing line breaks in short
CASEblocks and Expand for a detailed, well-structured format.
- Use Compact for minimizing line breaks in short