Last active
June 28, 2017 02:24
-
-
Save orthros/a2a1adc7cfd68106bdd1d78866969b27 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
begin tran | |
if exists (select * from dbo.BountyfulUsers with (updlock,serializable) where dbo.BountyfulUsers.UserName = '#[payload.userId]') | |
begin | |
update dbo.BountyfulUsers set BountiesCompleted += 1 | |
where dbo.BountyfulUsers.UserName = '#[payload.userId]' | |
end | |
else | |
begin | |
insert into dbo.BountyfulUsers (UserName, BountiesCompleted) | |
values ('#[payload.userId]', 1) | |
end | |
commit tran |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment