Here is another interesting feature called Surround With, introduced in SQL Server Management Studio (SSMS) in Denali CTP1. This feature allows us to select a set of T-SQL statements and enclose them into Transactional, Conditional, & Looping etc. constructs like Begin-End, If-Else, & While etc. Let us take a quick look at this feature.
Here are the step-by-step instructions for using Surround With feature of SSMS in Denali CTP1.
1. Select one or more lines/statements of T-SQL and right click and select Surround With… option from the context menu as shown below.
2. On selecting Surround With… from context menu, this brings up the Surround With menu with a list of options like Begin, If etc. as shown below.
3. From the list of options available in the Surround With drop down list, select the appropriate option/construct in which you want your code selected in first step to be enclosed. This will enclose the selected code snippet (in step 1) into the selected construct (in step 2) as shown below.
Here are other articles in the series Usability Enhancements in SSMS in SQL Server code-named Denali: