Created
July 6, 2018 03:22
-
-
Save alevyinroc/11338a940308fbe1a4eadabbd28e153b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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>Cursor</Title> | |
<Shortcut></Shortcut> | |
<Description>Code Snippet for T-SQL Cursor</Description> | |
<Author>Andy Levy</Author> | |
<SnippetTypes> | |
<SnippetType>Expansion</SnippetType> | |
</SnippetTypes> | |
</Header> | |
<Snippet> | |
<Declarations> | |
<Literal><ID>LoopVar</ID></Literal> | |
<Literal><ID>CursorName</ID></Literal> | |
<Literal><ID>TypeName</ID></Literal> | |
</Declarations> | |
<Code Language="SQL"><![CDATA[ | |
DECLARE @$LoopVar$ AS $TypeName$; | |
DECLARE @$CursorName$ as CURSOR; | |
SET @$CursorName$ = CURSOR FOR | |
$QueryToLoop$; | |
OPEN @$CursorName$; | |
FETCH NEXT FROM @$CursorName$ INTO @$LoopVar$; | |
WHILE @@FETCH_STATUS = 0 | |
BEGIN | |
FETCH NEXT FROM @$CursorName$ INTO @$LoopVar$; | |
END; | |
CLOSE @$CursorName$; | |
DEALLOCATE @$CursorName$; | |
]]> | |
</Code> | |
</Snippet> | |
</CodeSnippet> | |
</CodeSnippets> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment