webkeycode和一下代码类似
CREATE procedure [dbo].[gamekeycode]
@keycode char(20) outputas
begin tran
select top 1 @keycode=keycode from 游戏内序列号 with(readpast,updlock) where state <> '已使用'
update 游戏内序列号 set state = '已使用' where keycode = @keycode
if @@error = 0 commit tran
else rollback tran
GO
提取的SQL语句
declare @@keycode char(20)
exec gamekeycode @@keycode out
select @@keycode