SQL Code Snippets
Published 29 October 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.