-
Notifications
You must be signed in to change notification settings - Fork 0
/
Cursor.snippet
45 lines (43 loc) · 1.3 KB
/
Cursor.snippet
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
<?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>