Insert Surround-with Transact-SQL snippets
Applies to: SQL Server Azure SQL Database Azure SQL Managed Instance Azure Synapse Analytics Analytics Platform System (PDW)
A surround-with snippet is a template you can use as a starting point when enclosing a set of Transact-SQL statements in a BEGIN, IF, or WHILE block.
Inserting Surround-with Snippets
Surround-with snippets can be launched by one of three ways: through a keyboard shortcut, through the Edit menu, and through the context menu.
After inserting the snippet, you must change the replacement text to form a valid Transact-SQL statement. For more information, see Complete Transact-SQL Snippets.
To insert a surround-with snippet
In the Database Engine Query Editor window, select the set of statements to be included in the block.
Use one of these three methods to display the list of surround-with snippets:
Type CTRL+K, CTRL+S.
From the Edit menu, point to IntelliSense, and then select the Surround With command.
Right-click the selected text, and then select the Surround With command from the context menu.
Select the name of the snippet (BEGIN, IF, or WHILE) from the list either by using the mouse, or by typing the name of the snippet and pressing TAB or ENTER.