Inserting snippets
Published 11 February 2013
Snippets enable you to insert pre-defined code into your query editor.
To insert snippet code, type the snippet name and press Tab or any other specified insertion key. In some cases, only Tab is available to insert the snippet (for example when the snippet name could also be the name of an alias you are typing).
To see a list of available snippets, press Ctrl + Space to display the suggestions box, and select the Snippets category. You can also press Ctrl + Down arrow to move down the types of suggestion to Snippets.
A preview of the snippet code is displayed in the object definition box. (You can turn off the display of the object definition box - see Managing SQL Prompt behavior.)
The snippet code is inserted at the same indentation level as your SQL code at the point of insertion.
Using default snippets
SQL Prompt is pre-configured with a number of snippets. For example:
- ssf inserts a SELECT * FROM fragment
- cdb inserts a CREATE DATABASE statement and places the insertion point after the CREATE DATABASE fragment.
- cuci creates a unique clustered index
You can edit or delete the default snippets in the Snippet Manager dialog box.
Creating your own snippets
You can create your own snippets, including specifying the position at which SQL Prompt will place the cursor after it has inserted the snippet of code.