Customizing your Formatting Style
Published 29 October 2019
A formatting style is a saved set of options for how to lay out your SQL. To create or edit a formatting style, on the SQL Prompt menu, click Edit Formatting Styles.
SQL Prompt includes some Redgate styles that you can use as a starting point for your own style:
To create your own style, under YOUR STYLES, click + Create a style.
Your active style is the formatting style that is applied when you run Format SQL, and is marked with . To make a style active, make sure it is selected and click Set as active.
Old formatting styles
Styles created before SQL Prompt 8 will be imported automatically. These will appear under YOUR STYLES and have the suffix (old).
Note: SQL Prompt 8 includes new formatting options, so old styles might have changed after being imported.
To edit a style, make sure it is selected and click Edit style. SQL Prompt includes options for formatting DML statements, DDL statements, CASE statements, JOINs, CTEs, and more:
Disable formatting for blocks of code
You can disable SQL Prompt formatting for certain blocks of code in a query:
- In a query window, select the code you don't want SQL Prompt to format, and click Ctrl to open the actions list.
- Type di and select Disable formatting for selected text:
SQL Prompt encloses the selected code within comments:
This code now won't be formatted when you run Format SQL.
Formatting errors
If SQL Prompt wasn't able to format your code, a pop-up window will be displayed showing the reasons: