Advertisement
Guest User

Untitled

a guest
May 26th, 2019
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
JSON 0.51 KB | None | 0 0
  1. {
  2.  
  3.      "Create Cursor snippet":{
  4.      "prefix": "sqlCreateCursor",
  5.      "body": [
  6.         "-- Create a new cursor called '${1:CursorName}' on table '${2:TableName}' with values '${3:ValueName}'",
  7.         "DECLARE $1 CURSOR FOR",
  8.         "   SELECT $3",
  9.         "   FROM $2;",
  10.         "OPEN $1;",
  11.         "FETCH NEXT FROM $1 INTO @$3;",
  12.         "WHILE @@FETCH_STATUS = 0",
  13.         "   BEGIN",
  14.         "       --insert instruction",
  15.         "       FETCH NEXT FROM $1 INTO @$3;",
  16.         "   END;",
  17.         "CLOSE $1;",
  18.         "DEALLOCATE $1;"
  19.        
  20.      ],
  21.     "description": "Creating cursor"
  22.     }
  23.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement