T-SQL code snippets is a very handy new feature in SQL Server 2012 or later

Using code snippets you can save time when you write code and you just need to enter code that does common tasks. Code reuse has always been useful and it really increases productivity!

In SQL Server 2012 or later you can import your own custom-made snippets. However, prior to that, you need to create a snippet.

Each snippet is an XML file that specifies some header information regarding the snippet and then it includes the T-SQL code.

A sample T-SQL code snippet for SQL Server 2012 is illustrated in the following image:

Using Snippets Generator, you can generate T-SQL code snippets, save it into a directory and then add the directory, and consequently your custom snippets, into SQL Server 2012 Management Studio (SSMS) via the Code Snippets Manager! The directory's name will be the snippet category name in Code Snippet Manager and its contents will be the snippets!

You can either create a snippet from scratch or just make use of one of the snippet templates shipped with the tool in order to assist you with the design of your custom snippet. Furthermore, you can save your own snippets as templates.

Additionally, you can open an existing snippet generate a new one based on the original.




Last edited Sep 20, 2016 at 10:48 AM by ArtSQL, version 8