SQL Prompt - 5.0
Learning SQL Prompt - 5.0
Managing snippets
Snippets enable you to insert pre-defined code into your query editor. To view a list of snippets, on the SQL Prompt menu, select Snippet Manager.

The Snippet Manager dialog box displays a list of snippets, sorted alphabetically. To sort by description, click the Description column header.
Click on a snippet to view the code for that snippet in the Code area.
The snippet code is inserted at the indentation level of your SQL code at the point of insertion.
Creating a snippet from code you have typed
You can create a snippet from code you have typed into the query editor.
Select the code so that it is highlighted, then right-click and select Create Snippet.

The Create New Snippet dialog box is displayed, so that you can edit the snippet name or text if required.
The default snippet name is created automatically from the initial letters of the selected text. You can edit this, if you want to use a different name.
Creating a new snippet
- On the SQL Prompt menu, select Snippet Manager.
- Click New.
- In the Snippet box, type the text that will insert the snippet.
- Optionally, type a short description of your snippet in the Description box.
The description helps you to identify a snippet if you are unsure of the snippet name. You can leave the Description box blank if required.
- Type or paste the SQL code in the Code box.
The SQL you enter can contain the following placeholders:
$DATE$,$TIME$,$USER$,$MACHINE$.To specify the insertion point at which you want the cursor to be placed when the snippet is inserted, type
$CURSOR$. For example:SELECT $CURSOR$ FROM
places the insertion point after SELECT.
- Click Save.
Editing snippets
In the Snippet Manager dialog box, select the snippet that you want to edit and click Edit, or double-click the snippet. Then, in the Edit Snippet dialog box, change the details as required and click Save.
Sharing snippets
You can send your snippets to other SQL Prompt users, or use snippets they send you.
To use a snippet that someone has emailed you, you need to copy the individual snippet file (.sqlpromptsnippet extension) to the Snippets folder:
- From the SQL Prompt menu, select Snippet Manager.
- In the Snippet Manager dialog box, click Locate on Disk to view the path to the Snippets folder (by default, this is
C:\Documents and Settings\<your user name>\Local Settings\Application Data\Red Gate\SQL Prompt 5\Snippets) - Close the Snippet Manager dialog box.
- Copy the .sqlpromptsnippet file to the Snippets folder.
- Re-open the Snippet Manager. The new snippet will be displayed in the list.
Dealing with duplicate snippets
Snippet names are defined by the <Shortcut> tag in the .sqlpromptsnippet file.
If a snippet file you have copied to the Snippets folder uses the same name as an existing snippet, a warning is displayed:
![]()
Use the green arrow buttons to locate the next/previous duplicate snippet in the list, then do one of the following:
- Click Delete to remove the duplicate. (Use the Code preview box to check which snippet you are deleting).
- Click Edit and change the name in the Snippet box to a unique name.
Note: You can also edit the .sqlpromptsnippet file in a text editor to change the value of the <Shortcut> tag.
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