How to: Outline & Add Snippets to T-SQL Script
09/10/2025 SQL Server Data Tools includes a code library consisting of code snippets that are ready to be inserted in your application. Each snippet performs a complete scripting task such as creati
Data Tools includes a code library consisting of code snippets that are ready to be
inserted in your application. Each snippet performs a complete scripting task such as creating a
function, table, trigger, index, view, user-defined data type, etc. You can insert a snippet into
your source code with your pointing device. These snippets increase your productivity by
reducing the amount of time you spend typing.
When you need to browse for an appropriate snippet, you can use the snippet picker, which
gives you categorized lists of snippets to choose from. Once you have added the snippet to
your code, there might be parts of it that need customization, such as replacing variable names
with more appropriate names, or putting in the actual logic of a stored procedure. You notice
that the inserted snippet code has one or more replacement points highlighted in the code for
this purpose. If you rest your mouse pointer over the replacement point, a ToolTip appears that
explains how you can change the code.
By default, all text is displayed in the Transact-SQL Editor, but you can choose to hide some
code from view. The Transact-SQL Editor allows you to select a region of code and make it
collapsible, so that it appears under a plus sign (
). You can then expand or hide the region by
selecting the plus sign (
) next to the symbol. Outlined code isn’t deleted; it’s hidden from
view.
- Right-click the
project in
and select
, then. In the
dialog box, select.
- Right-click the Transact-SQL editor and select. The code snippet picker
appears.
- Double-click
in the code snippet picker, then double-click.
2
Warning
The following procedure uses entities created in previous procedures in the
SQL database
sections.
TradeDev