Mitch’s Quick Tips – #4 SQL 2012 IntelliSense’s Surround With…

In my second quick tip, I wrote about SQL 2012 IntelliSense Code Snippets in the intelliSense menu. In case you didn’t notice in the drop down for the Code Snippets, there was another option for ‘Surround with…’ just below it. What is this you might ask? Well, it is exactly what it sounds like. This option will allow you to create code that would sound a statement, like the typical Begin/End or While statements.

You would create these the same way you would the Code Snippets. When you are in SSMS (SQL Server management Studio) and open a New Query window, you can simply right-click in that window and click on Surround With… (You can also type Crtl+K, Ctrl+S). The third way is to click Edit on the main menu, chose IntelliSense > Surround With…

SSMS_SW_1

Once you click Surround With… it will display 3 different choices. They are the Begin Statement, the If Statement or the While Statement.

SSMS_SW_2

Once you click on one, it will write the basic T-SQL code for you. All you have to do is fill in the Condition and what you wish to execute during that condition.

SSMS_SW_3

Is this a huge time saver? Not really, but for people new to T-SQL coding, it will set them up with the basic format.

Advertisements
This entry was posted in Uncategorized. Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s