Skip to content

Instantly share code, notes, and snippets.

@orthros
Last active June 28, 2017 02:24
Show Gist options
  • Save orthros/a2a1adc7cfd68106bdd1d78866969b27 to your computer and use it in GitHub Desktop.
Save orthros/a2a1adc7cfd68106bdd1d78866969b27 to your computer and use it in GitHub Desktop.
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