How to create, use, edit and delete SQL formatting profiles

In this article, we will introduce how to use ApexSQL Refactor SQL formatting profiles and is a guide through the process of managing SQL formatting profiles.

Transcript

Hello, and welcome to this video presentation in which we will introduce how to use ApexSQL Refactor SQL formatting profiles and is a guide through the process of managing SQL formatting profiles.

Four built-in profiles come with the installation of ApexSQL Refactor which can be used to format your SQL code:

  • ApexSQL
  • Compact
  • Extended
  • MSDN SQL BOL

These four profiles cannot be changed in any way. For example, if you try to change some settings the following message will appear:

Change settings in the built-in  profiles

Or to edit profile:

Edit settings in the built-in  profiles

The similar message will appear if you try to delete a built-in formatting profile:

Delete the built-in profiles

Create SQL formatting profile

To create a new profile from an existing built-in or user-defined profile, from the Profile drop-down list, choose the profile which should be copied and click the Copy button:

Copy profile

Under the Copy profile window, if needed the name, author, and description can be changed:

Copy profile window

When all is set, click the OK button, and the newly copied profile will appear in the Profile drop-down list:

Copied profile

To create a completely new formatting profile, click the New button and under the Create profile window, enter a name for a profile. Optionally, you can add an author name of the profile and the description of an additional explanation of the profile. When everything is set, click the OK button:

Creating a new profile

Please note, in order to formatting profile be saved for later usage in the Options window, click the Save button otherwise, the newly created profile won’t be saved.

Edit user-defined SQL formatting profiles

To edit newly created profile information, click the Edit button, in the Edit profile window, change the information and click the OK button:

Edit profile

Delete user-defined SQL formatting profile

To delete the profile, from the Profile drop-down list, select a user-defined profile that should be deleted and click the Delete button. In the confirmation dialog, click the Yes button. The deleted profile will be removed from the Profile drop-down list:

Delete profile

In order for changes to take effect, in the Options window, click the Save button.

Export/import SQL formatting profiles

To export user-defined profiles in the Options window, click the Export button and, from the Export profiles window, select the profiles and click the OK button:

Exporting profiles

The exported formatting profiles will be saved as an XML document.

The opposite process of exporting is importing formatting profiles. In the Options window, click the Import button, locate formatting XML file and click the Open button:

Importing profiles

From the Import profiles window, select the profiles that should be imported and click the OK button:

Import profiles window

Set default SQL formatting profile

To format a SQL code using your newly created formatting profile, in the query editor, right-click and from the Format SQL by profile sub-menu, choose your formatting profile:

Format SQL code by using profile via query editor context menu

Another way to initiate this command is via ApexSQL Refactor main menu:

Format SQL code by using profile via ApexSQL Refactor main menu

To set a newly created profile to be a default profile for future formatting of SQL code, go to the Options window, in the Profile drop-down list, select the profile and click the Set as active button:

Set default profile

Now, you can use the Format SQL command via ApexSQL Refactor toolbar or use the Ctrl+Shift+Alt+F shortcut to format SQL code in the query editor with default profile:

Format SQL code with default profile

Thanks for watching. For more information, please visit www.apexsql.com