Open topic with navigation
< To bookmark a page, right-click the Page Title and select Add to Favorites / Bookmark This Page
|
Toad for SQL Server 5.7
|
Insert Code Snippets
Code snippets are segments of reusable code that you can easily
insert into a SQL statement when working in the Editor. You can also use code snippets to:
- Create custom code templates
to ensure consistency in code development
- Distribute code
libraries to your development group
To insert a code snippet
-
In the Editor, place the cursor where you want to insert the snippet, then do one of the following:
- Double-click the snippet in the Code Snippets window.
- Press CTRL+SPACE
to select from a list of snippets (organized in folders by snippet type).
- Drag the snippet
from the Code Snippets window to the insertion point.
Notes:
- When using CTRL+SPACE to select from a list, as
you expand the snippet treelist, the path displays in the Insert Snippet
bar. You can use the path to navigate back to a folder in the path.
- When using CTRL+SPACE to select from a list, click
the snippet to view a description.
- You can use incremental search to find a snippet or folder in the list by typing the first letters of the snippet or folder name.
-
Enter the parameter
values.
Tip: Press
TAB or SHIFT+TAB to navigate between parameters.
-
Press ENTER to exit
the snippet.
To insert a Surround With code snippet
Select the block of text to surround in the
Editor and do one of the following:
- Right-click and select Surround with....
- Double-click the snippet in the Code Snippets window.
To search for a code snippet
-
Select
View | Code Snippets from the
menu (CTRL+ALT+T).
-
Enter the name (or partial
name) of the snippet or a keyword for the snippet in the Search
field. Press ENTER.
Tips:
- Press F1 immediately after inserting a snippet (while the snippet is still active) to open an online reference for that snippet, or select the snippet in the Code Snippets window and then click the online reference link in the bottom pane below the snippet description.
-
If you know the
shortcut name for a snippet, enter the shortcut name and press CTRL+SPACE.
-
To insert a snippet
saved in the Favorites or Shared Toad / Shared Snippets folders, press CTRL+Q, and select the
snippet. You can specify another name for your Favorites Folder
in Tools | Options | Editor | Code Completion.
- You can define a Shared Snippets Folder in Tools | Options | Environment | Network Share, to share snippets with colleagues. The Shared Snippets folder will replace the Shared Toad folder as the location for saved snippets when you select Add to shared folder when creating a snippet from the Editor.
- Right-click a snippet in the Code Snippet window and select Open in New Editor to open a new Editor window that already contains the snippet.
Related Topics
Create Code Snippets
About Editing SQL