How to use SQL snippets

A SQL code snippet is a fragment of reusable code or statement that can be added or edited by a user. To view the snippets, navigate to the SQL Complete menu and select Snippets Manager.

Invoke snippets

To invoke snippets, use one of the following options:

  • Suggestion box: Press Ctrl+Space and scroll down the suggestion list - snippets will be listed after keywords.
  • Snippet shortcuts: Start typing a snippet shortcut and view the content of the corresponding snippet. For instance, ssf will show SELECT * FROM.

Snippet shortcut

Commit snippets

To commit a snippet, do either of the following:

  • Press Enter when the code snippet is shown in the suggestion box.
  • Press Tab when the suggestion box is closed and the statement expansion tags are shown.

Note

Tab is the default commit button. However, you can configure the commit button to be, for example, Space. To do this, go to the SSMS main menu, navigate to SQL Complete > Options > List Members and select Whitespace within Commit Selection.

List Members

After inserting snippets, it is possible to configure the parameters of the snippet. For instance, you inserted the CTE (Common Table Expression) snippet:

To configure the parameters, in the CTE name placeholder, enter “query” and then press Tab to enter the schema name. You can enter only initial letters like “hr”, and thanks to the CamelHumps feature, “HumanResources” will be automatically selected in the suggestion list.

Press Tab to enter the table name. You can type the first symbols like “emp” and then choose an “Employee” table from the list, press the Enter key.

To discard the insertion and exit the insert mode of snippet parameters, press Esc.

To learn more about creating snippets and using placeholders, see How to manage SQL snippets.

The difference between SQL Complete snippets and SSMS templates/snippets

SQL Complete expands the built-in capabilities of SSMS template and snippet functionality and helps make the usage of snippets more flexible.

The added value of SQL Complete includes but is not limited to a rich variety of replacement points (introduced via placeholders), customizable sharing options, easy creation, and reuse of custom snippets.

Want to Find out More?

Overview

Overview

Take a quick tour to learn all about the key benefits delivered by dbForge SQL Complete for SQL Server.
All Features

All features

Get acquainted with the rich features and capabilities of the SQL Complete in less than 5 minutes.
Request a demo

Request a demo

If you consider employing the SQL Complete for your business, request a demo to see it in action.
Ready to start using dbForge SQL Complete for SQL Server?