SQL Prompt 7

Formatting your code

Setting the format options

To set formatting options, on the SQL Prompt menu, select Options. On the SQL Prompt Options dialog box, formatting options are all available in the Format group:

Click the page containing the type of format options you want to set.

These settings will affect the appearance of your code only after you close the Options dialog box and then insert suggestions or select Format SQL.

For more information about formatting options, see Options for formatting your code.

Previewing the format options

There are two ways to preview the effect of applying the current format options to your code:

  • The Sample SQL view shows how an example query would be formatted using the current options.
  • The Current Query view shows how the first few lines of the query that is currently active in the editor window of your SQL editing application (eg SSMS) would be laid out using the current options.

    Current Query is available only when you are currently editing a query.

Formatting your SQL

To format the SQL code in the current query editor or a highlighted SQL code fragment, do one of the following:

  • on the SQL Prompt menu, click Format SQL
  • right-click in your query editor window and click Format SQL
  • press Ctrl + K + Y (hold down Ctrl and press K then Y)

Not all SQL commands can be refactored by SQL Prompt. For unsupported commands only the wrapping option is applied.

Saving your format options as a style

When you have set up all your format options, you can save them as a style. Styles allow you to reapply all your format options without having to change each one again.

Didn't find what you were looking for?