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