Snippets Updated
Snippets are reusable SQL templates. Type a short code, press Tab, and the full template expands in the editor with placeholders you can tab through and fill in.
Snippet sources
AKML SQL loads snippets from three places:
- Built-in — a library that ships with the plugin (create table, transaction wrappers, and more).
- Personal — your own snippets, stored on your machine.
- Team — an optional shared folder your whole team points at.
Snippets also appear in the IntelliSense completion list with a {} icon.
Expand a snippet
- Type the snippet's shortcode, for example
ctfor Create Table. - Press Tab.
- The template expands. The first placeholder is highlighted — type to replace it.
- Press Tab to jump to the next placeholder, Shift+Tab to go back.
If several snippets match, pick one from the completion popup first. Snippets can be formatted automatically on expand, matching your active format style.
Surround selected code
- Select one or more statements.
- Press Ctrl+K, Ctrl+S (default) to open the surround-with picker.
- Choose a surround snippet, such as a transaction with
TRY/CATCH.
The selected code is inserted where the template marks $SELECTEDTEXT$.
Create your own snippet
- Select the SQL you want to reuse.
- Right-click and choose Create Snippet from Selection.
- Give it a name, a shortcode, and optional tags.
- Add
$CURSOR$where the caret should end up after expansion. - Save. The snippet works immediately.
Snippets are stored as .akmlsnippet files (plain JSON), so you can also create or edit them with any text editor.
Where snippets are stored
%AppData%\AKML SQL\snippets\personal\
- Personal snippets live in the folder above (you can override the path in Options).
- Team snippets live in whatever folder you set as the team folder — point it at a shared drive or a synced folder.
- Built-in snippets are embedded in the plugin and cannot be edited.
Import from SQL Prompt
The Snippet Manager can import a Redgate SQL Prompt snippet library (.sqlpromptsnippet files). It detects the SQL Prompt folder automatically, converts each snippet to the .akmlsnippet format, and reports any shortcode conflicts.
Settings
Open AKML SQL -> Options… -> Suggestions -> Lists & connections (Snippets section) to turn snippets on or off, format them after they expand, and set a team snippet folder. See the Configuration reference for all keys.