Home » SQL Server » SQL Server 2012 – T-SQL Code Snippets

SQL Server 2012 – T-SQL Code Snippets

The snippets in SQL Server 2012 are essentially templates that can help in building database statements.

T-SQL snippets helps you in quickly building up T-SQL statements without having to remember the commands or their syntax. You can use this feature to reduce development time, syntax mistakes and increase productivity for your developers and DBAs. Snippet templates in SQL Server 2012 are based on XML with predefined fields and values. When you use a T-SQL snippet, these fields are highlighted and you can tab through each field and change the values as required.

Snippets are categorized as per use. You can view and select various snippets based on the category.

SQL Server 2012 introduces three types of snippets:

1. Default Snippets (or Expansion Snippets) under “Insert Snippet” option : These are code templates for various T-SQL commands you can quickly insert into your T-SQL code when creating tables, stored procedures, triggers and so on.

2. Surround Snippets under “Surround with” option : These are code templates that help you implement code constructs such as Begin End, If, While.

3. Custom Snippets: You can create your own custom snippets that will appear with the snippet menu.

Snippet & Surround Option (On Right click in query window) Insert Snippet of desired Type Insert Surround snippet of desired type

By default, all T-SQL snippets are stored in the following folder and saved as .snippet files: C:\Program Files\Microsoft SQL Server\110\Tools\Binn\ManagementStudio\SQLSnippets\1033


2 Comments

  1. I was recommended this web site by way of my cousin. I am now not certain whether or not this publish is written by way of him as nobody else know such specified about my problem. You’re incredible! Thanks!

  2. Hey there, You have performed a great job. I will certainly digg it and in my view suggest to my friends. I’m confident they will be benefited from this site.

Leave a Reply

Join us on Facebook

microsoftcommunitycontributor
%d bloggers like this: