Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- {
- "Create Cursor snippet":{
- "prefix": "sqlCreateCursor",
- "body": [
- "-- Create a new cursor called '${1:CursorName}' on table '${2:TableName}' with values '${3:ValueName}'",
- "DECLARE $1 CURSOR FOR",
- " SELECT $3",
- " FROM $2;",
- "OPEN $1;",
- "FETCH NEXT FROM $1 INTO @$3;",
- "WHILE @@FETCH_STATUS = 0",
- " BEGIN",
- " --insert instruction",
- " FETCH NEXT FROM $1 INTO @$3;",
- " END;",
- "CLOSE $1;",
- "DEALLOCATE $1;"
- ],
- "description": "Creating cursor"
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement