Search code examples
sqlvisual-studiovisual-studio-2013visual-studio-2015code-snippets

VS13/VS15 - can't import SQL snippet


I would like to create SQL snippet in VS2013 and VS2015. I don't know why, but I've got an error while importing (in both of VS):

"C:\sql.snippet: Missing or unspecified Language attribute"

My snippet:

<CodeSnippets
xmlns="http://schemas.microsoft.com/VisualStudio/2008/CodeSnippet">
<CodeSnippet Format="1.0.0">
    <Header>
        <Title>
            My Snippet
        </Title>
    </Header>
    <Snippet>
        <Code Language="SQL">
            <![CDATA[select * from MyTable]]>
        </Code>
    </Snippet>
</CodeSnippet>

What's wrong? The language SQL should be OK https://msdn.microsoft.com/en-US/library/ms171418.aspx#code

I tried to add this snippet to language "Miscrosoft SQL Server Data Tools, T-SQl..." If I've changed the language attribute to e.g. CSharp it works.


Solution

  • Instead of:

    <Code Language="SQL">
    

    Write:

    <Code Language="SQL_SSDT">
    

    Visual Studio supports only MSSQL Server Data Tools & T-SQL Language Scripts, not SQL like SSMS does.