Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DECLARE @u_cPoints int, @c_creditPoints int;
- DECLARE cpoints_cursor CURSOR FOR
- SELECT *
- FROM CreditPoints, Users
- WHERE CreditPoints.userId=Users.userId
- OPEN cpoints_cursor;
- FETCH NEXT FROM cpoints_cursor
- INTO @u_cPoints, @c_creditPoints;
- WHILE @@FETCH_STATUS = 0
- BEGIN
- UPDATE Users
- SET Users.cPoints = Users.cPoints + @c_creditPoints;
- FETCH NEXT FROM cpoints_cursor
- INTO @u_cPoints, @c_creditPoints;
- END;
- CLOSE cpoints_cursor
- DEALLOCATE cpoints_cursor;
- GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement