SQL Code Snippets
Published 06 S 2019
A snippet is any pre-defined block of code, which you can insert into a query pane at the current cursor position, or around currently selected SQL text. SQL Prompt comes with many pre-defined snippets, which you can customize as required, as well as allowing you to create your own.
At their simplest, they are a code-completion device that will save you a few keystrokes when typing in fragments of SQL text that you use often. For example, when you type ssf, SQL prompt invokes the snippet of that name and inserts "SELECT * FROM" into the query window. However, snippets will also help teams to standardize coding practices during team development and increase code quality. More experienced team members can share snippets that help introduce standards and consistency to the way the team build objects and modules, for example in terms of structure of any headers, inclusion of guard clauses, error handling, and so on. The team can also, for example, share standardized snippets for testing code, or investigating slow-running code. This will both save time and produce results in a team-standard format, which makes for much easier team collaboration during troubleshooting.
Documentation for SQL Code Snippets
- Creating and Using SQL Code Snippets (Quick Ref)
- Inserting snippets
- Managing snippets
- Sharing snippets
- Using SSMS templates in SQL Prompt snippets
If you're new to using SQL Prompt, try following the worked examples.
Additional Resources for SQL Code Snippets
In addition to this documentation, the Redgate Hub offers the following resources to help you find your way around SQL Code Snippets, learn how to use it, and adopt best practices :
- Redgate University online video classes:
- Product learning technical 'how-to' articles: