Code Formatting

You can configure a number of formatting rules to specify how the Enlighten SQL command reformats your SQL code.
To do this on the SQL Enlight menu click Options and then select the Layout Rules tab.

The exact effect of customization of each layout rule over the SQL code can immediately be seen in the
Preview box. It shows a SQL statement with all currently active formatting rules applied.

The SQL code in the preview box is editable and can be changed with a custom preview code.

code-formatting-preview-edit-mode

When the changes are accepted, the formatting will be applied to the new preview code. The Reset button will reset the preview text to default.

Default Behavior
  • T-SQL statements are completely rewritten thus it follows a couple of rules that cannot be changed.
  • FROM WHERE GROUP BY and ORDER BY clauses are always placed on a new line.
  • Breaks before the opening and after the closing parenthesis are only inserted when parentheses do not take part in expression – neither logical nor arithmetic.

Formatting rules are separated into three main groups: General, Expressions, and Statements.

See Also