SQL Server Data Tools (SSDT) has a neat feature where you can add snippets into your scripts via the right-click context menu:
I’m finding it very useful indeed. The same feature exists in SQL Server Management Studio (SSMS) as well by the way:
One thing I really wanted to be able to do was create my own snippets for SSDT and I ventured to the SSDT forum to ask if it was possible. Turns out the answer is “yes” and Gert Drapers replied to my thread by providing an excellent run through of how to do it. What Gert’s post didn’t quite clarify is that if you follow his instructions then you have to manually edit the .snippet file that you created so that the language is set to SQL_SSDT:
(well, I had to do that anyway)
Once you do that you’ll be able to import the snippet into Visual Studio (Gert’s post shows you how) and thereafter your snippets will show up in the snippets menu:
Very handy indeed.