SQL Prompt - 5.3
Options for formatting your code - SQL Prompt
To set formatting options, on the SQL Prompt menu, select Options. The formatting options are all available in the Format group:

Note: If you are using SQL Prompt Standard Edition, the format pages are unavailable; but you can set a number of options for how inserted code is formatted on the Basic (Standard Edition) page:

To review the effect of any changes you make, use the Preview tab:
- 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 SQL Server Management Studio) would be laid out using the current options.
Case
Case options are available in both Standard and Pro Editions of SQL Prompt:
- In Standard Edition, case options are on the Format > Basic (Standard Edition) page
- In Pro Edition, case options are on the Format > Case page
Selecting UPPERCASE or lowercase will replace any words you have typed with the selected case, and also insert any suggestions using the selected case.
For example, if UPPERCASE is selected:
- If you have already typed
selectorSelectin your query, SQL Prompt replaces the word withSELECT. - If you type
selorSeland then insert SELECT from the suggestions box, SQL Prompt insertsSELECT.
Selecting Leave as is will leave the case of any letters you have already typed, but insert the remainder of the word using the case of the last typed letter.
For example:
- If you type the entire word
Select, SQL Prompt leaves the word exactly as typed. - If you type
Sel, SQL Prompt will insertSelect. - If you type
SEL, SQL Prompt will insertSELECT.
Changing the case in pasted code
When you paste code into your query editor, you can apply your preferred case to that code. This is only available in SQL Prompt Pro Edition.
- Set the case options for keywords, functions, and data types as required on the Format > Case page of the SQL Prompt Options dialog box.
- Click OK to save these settings.
- In your query editor, select all the lines of code to which want to apply the case.
- On the SQL Prompt menu, select Format SQL.
Note: This will also apply all other format settings (such as indentations, new line settings, and so on) to that code.
Schema statements
Options for formatting new lines and indents in CREATE and ALTER statements.
Data statements
Options for formatting new lines, parentheses and indents in SELECT, INSERT, UPDATE and DELETE statements.
Expressions
Options for formatting parts of statements, for example how Boolean and other types of operators should appear.
Commas & parentheses
Options for formatting where commas should appear in your SQL statements (at the end or beginning of lines), and how they should align with other lines of code.
Tabs & wrapping
Options for tabs and spaces and when to wrap lines.
Formatting SQL in your current editor window
To format the SQL code in the current query editor or the highlighted SQL code fragment, do any of the following:
- on the SQL Prompt menu, select Format SQL
- press Ctrl + K,Y (hold down Ctrl and press K then Y)
Saving format settings
You can use styles to save your preferences for formatting code. See Using styles to format your code.
Was this article helpful?
SQL Prompt
- SSMS failed to load SQL Prompt add-in 80070002
- No SQL Prompt menu appears in Query Analyzer
- SQL Prompt is showing an old version of my stored procedure (version 3)
- Removing menu items after uninstalling SQL Prompt and SQL Refactor
- A newly-created table exists, but it is not visible in the candidate list (version 3)
- Configuring permissions for SQL Prompt
- Using Intellisense or auto complete with a VS Web project (version 3.5)
- Uninstalling the Visual Studio 2005 add-in
- Unable to cast object of type 'System.DBNull' to type 'System.String' (version 3)
- Suggestions to improve performance for pre-formatted SQL (version 3.9)
- Changing the location of the settings, cache files and snippets folders
- Saving SQL Prompt options (version 3)
- SQL 2008 installation fails with Express Tools rule (version 3.8)
- Add-in failing to load into SQL Server Management Studio on Vista
- Removing SQL Server Management Studio Integration after uninstallation
- Layout SQL Error
- Downgrading to SQL prompt 3.9 from 4.0
- Candidate suggestions being displayed slowly
- SQL Prompt is not showing all linked servers
- Log files
- Refreshing the cache
all SQL products
- Compatibility of Red Gate tools in 64-bit environments
- Application has encountered an error and needs to close
- Error message after installing SQL Toolbelt - The description for Event ID ( 1 ) in Source ( nview_info ) cannot be found.
- Changing the temporary directory used by the installer
- Toolbelt Installer "hanging" while "scanning volumes"
- Login failing with "trusted SQL Server connection" error when using RunAs
all products
- Some Red Gate products identified as containing a trojan by Anti-Virus software
- Activation may fail with Unknown Error -1
- Product uses web help although a CHM file is available locally
- Argument exception resulting from missing environment variable
- Check for updates may fail when used through proxies
- 'Unidentified Publisher' error when repairing or uninstalling
- Licensing activates product as standard edition
- Moving Red Gate software products to another machine
- Red Gate tools log locations
- The application UI opening slowly when there is no internet access
SQL Prompt
- Activating your products
- Activating your products
- Getting help offline
- Customizing SQL Prompt to write SQL code more efficiently
- SQL Prompt 3.xx - reducing memory usage to improve performance
- Using SQL Prompt 4: tips for SQL Prompt 3 users
- SQL Prompt release notes - version 4.xx
- Release notes - version 5.xx
all SQL products
all products
- Red Gate product acknowledgements
- Activating your products
- Activating your products
- Red Gate bundle history
- Check for updates
- Troubleshooting Check for Updates errors
- Current versions
- Deactivating your products
- Installing Red Gate products from the .msi file
- Requesting additional activations
- Serial numbers for bundles
- Reactivating using a different serial number
- Extending your trial
- Finding your serial numbers
- Moving a serial number from one computer to another
- No response received for manual activation
- Licensing and activation resources
- Licensing and activation resources
- Troubleshooting licensing and activation errors
- Licensing and activation FAQs
- Red Gate tools log file locations
- Download old versions of products
- Download product prerequisites & utilities
- Support & upgrades
- Upgrading your software
- Upgrading FAQs

Using SQL Prompt