SQL Prompt   

Managing Snippets

See Also

Snippets enable you to insert code in your query editor when you type a snippet name and then press ENTER. You can set other completion keys that will insert candidates, for example TAB.

SQL Prompt is pre-configured with default snippets, for example, the ssf snippet inserts a SELECT * FROM fragment. Similarly, the cdb snippet inserts a CREATE DATABASE statement and places the insertion point after the CREATE DATABASE fragment for you to specify the name of the new database. You can edit or delete the default snippets.

You can create your own snippets of code, including specifying the position at which SQL Prompt will place the cursor after it has inserted the snippet of code. You specify the insertion point using the variable $CURSOR$. For example, SELECT $CURSOR$ FROM places the insertion point after SELECT.

To manage snippets, on the SQL Prompt menu in your query editor, click Options, and then click the Snippets tab.

The Snippets tab displays a list of default and custom snippets, listed in alphanumeric order. You can view the code for a snippet by clicking it.

To restore the default snippets if you have edited or deleted them, right-click the list of snippets, and click Reset default snippets.

Creating snippets

  1. Click New.

    The Snippet Properties dialog box is displayed.

  2. Type a name for your snippet in the Snippet box.
  3. Type a short description of your snippet in the Description box.

    If you are unsure of the snippet name, the description helps you to identify a snippet.

  4. Select a Category:
    • Access Control
    • Administrative
    • Analysis Services
    • Control Flow
    • DDL
    • DML
    • Miscellaneous
  5. Type or paste the SQL code in the Code box.
  6. Click Save.

Editing snippets

  1. Select the snippet that you want to edit.
  2. Click Edit.

    The Snippet Properties dialog box is displayed.

  3. Change the details as required.
  4. Click Save.

Deleting snippets

  1. Select the snippet that you want to delete.
  2. Click Delete.

 

 

 


© Red Gate Software Ltd 2007. All Rights Reserved.