Quantcast
Channel: Database –龙堂
Viewing all articles
Browse latest Browse all 12

Create your own TSQL code snippets in Visual Studio 2010

$
0
0

Mark the way for how to create custom TSQL(or other language) code snippets in Visual Studio 2010

1. Create a .snippet text file similar like the following from your favorite text editor

<?xml version="1.0" encoding="utf-8" ?>
<CodeSnippets  xmlns="http://schemas.microsoft.com/VisualStudio/2005/CodeSnippet">
<_locDefinition xmlns="urn:locstudio">
    <_locDefault _loc="locNone" />
    <_locTag _loc="locData">Title</_locTag>
    <_locTag _loc="locData">Description</_locTag>
    <_locTag _loc="locData">Author</_locTag>
    <_locTag _loc="locData">ToolTip</_locTag>
</_locDefinition>
  <CodeSnippet Format="1.0.0">
    <Header>
      <Title>[your snippet title]</Title>
      <Shortcut></Shortcut>
      <Description>[your snippet tool tip]</Description>
      <Author>[yourname or author name here]</Author>
      <SnippetTypes>
        <SnippetType>Expansion</SnippetType>
      </SnippetTypes>
    </Header>
    <Snippet>
      <Declarations>
        <Literal>
          <ID>UserStoryID</ID>
          <ToolTip>ID of the related User Story</ToolTip>
          <Default>UserStoryID</Default>
        </Literal>
        <Literal>
          <ID>UserStoryTitle</ID>
          <ToolTip>Title of the related User Story</ToolTip>
          <Default>UserStoryTitle</Default>
        </Literal>
        <Literal>
          <ID>Description</ID>
          <ToolTip>Desciption of the script</ToolTip>
          <Default>Desciption</Default>
        </Literal>
        <Literal>
          <ID>Author</ID>
          <ToolTip>Author of the script</ToolTip>
          <Default>Author</Default>
        </Literal>
        <Literal>
          <ID>CreateDate</ID>
          <ToolTip>Ceated date of the script in format yyyy-mm-dd</ToolTip>
          <Default>CreateDate</Default>
        </Literal>
      </Declarations>
      <Code Language="SQL"><![CDATA[
/*
-------------------------------------------------------------------------------
Desc: $Description$
Auth: $Author$
Date: $CreateDate$

Related User Story:
$UserStoryID$: $UserStoryTitle$

Change History
-------------------------------------------------------------------------------
Ver        Date        Author        Description 
----    ----------    -------        -----------------------------------------------
1.00    $CreateDate$    $Author$        $Description$
-------------------------------------------------------------------------------
Script information:
-------------------------------------------------------------------------------
*/
]]>
      </Code>
    </Snippet>
  </CodeSnippet>
</CodeSnippets>

2. Import the snippet file from VS 2010

Tools -> Code snippets Manager -> import… -> to a proper folder

3. The newly created snippet can be used



Viewing all articles
Browse latest Browse all 12

Trending Articles