Double your Coding Speed using SQL Code Snippets


SQL Server Management Studio provides a cool feature called ‘Code Snippets’ which can help you to considerably increase your coding speed. Code Snippets are ready made snippets of code, which you can insert into your T-SQL code. As a result, you can type less and generate more code.

Using Code Snippets in your day to day work is a great time saver, since there is no need to remember any syntax while you are creating your tables, stored procedures, indexes and more. You can also create your own custom snippets and add to the pre-defined snippets available in SQL Server.

SQL Snippets can be categorized into two types —

Expansion Snippet Type – CTRL K + X

Surround With Snippet Type – CTRL K + S

In the SSMS IDE, you can bring up the Insert/Expansion code snippet menu by just clicking on CTRL K + X.

You can then navigate through the folders and select the snippet you want to use.

Based on your selection, you will now see the snippet for creating a new non-clustered index.

codesnippets

index
And you are done!
As you saw, there was no need of remembering the SQL syntax nor you had to look online for the apt syntax. With SQL Code Snippets you get all the syntax available to you at the tip of your fingertips in SSMS.

You can also press CTRL K + B to bring up the Code Snippets Manager, where you can see all the code snippets and manage them.

To summarize, Four reasons why I really like SQL Code Snippets are —

  • No need of remembering the complex T-SQL syntax.
  • Increased Productivity – Type less and generate more code.
  • Code Reuse – Less effort and time spent.
  • Ability to create custom snippets for frequently used scripts.

I would highly recommend you to start leveraging the benefits of using ‘SQL Code Snippets’ in your day to day work.

 

To learn more SQL Tips and Tricks & other Productivity Enhancements in SQL Server Management Studio, please refer my article links below —

SQL Server Management Studio 2016 Productivity Enhancements

Increase your Coding Speed in SQL Server Management Studio

Advertisements

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