THE SQL Server Blog Spot on the Web

Welcome to - The SQL Server blog spot on the web Sign in | |
in Search

Jamie Thomson

This is the blog of Jamie Thomson, a data mangler in London working for Dunnhumby

Creating your own SQL snippets in SSDT

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.


Published Monday, April 22, 2013 11:33 PM by jamiet

Comment Notification

If you would like to receive an email when updates are made to this post, please register here

Subscribe to this post's comments using RSS



CB said:

I have been using autoHotKey's hotstrings feature for years... gives me my snippet's in all applications.

I fixed the escaping in the example Hotstring Helper to work with code.

April 23, 2013 3:56 PM

Wolfgang said:

The main disadvantage of having to Change the Language-Tag to "SQL_SSDT" is that These snippets are not available any more in the SQL Server Management Studio.

I'd really like to use my snippets with both, Management Studio and Visual Studio.

November 26, 2014 8:11 AM

John Meyer said:

Making a snippet reusable across both SSMS & SSDT is another manual edit to the file.  When you open a snippet file, it's just XML, the root element is <CodeSnippets> and that element has a child <CodeSnippet>... just duplicate the child <CodeSnippet> element (copy/paste), and change one of them to SQL_SSDT leaving the other SQL.

Sucks that there isn't a cleaner way to do it, but duplicating either the <Code> or <Snippet> element invalidates the file.

January 14, 2015 2:49 PM

Leave a Comment


This Blog


Privacy Statement