Skip to content

Instantly share code, notes, and snippets.

@orthros
Last active June 28, 2017 02:24
Embed
What would you like to do?
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