52 lines
1.1 KiB
Transact-SQL
52 lines
1.1 KiB
Transact-SQL
CREATE PROCEDURE [dbo].[up_update_reward_coupon]
|
|
@auth_id uniqueidentifier,
|
|
@character_id uniqueidentifier,
|
|
@character_name nvarchar(16),
|
|
@bcust_id nvarchar(50),
|
|
@IP varchar(16),
|
|
@coupon_type int,
|
|
@coupon nvarchar(50),
|
|
@use_date datetime,
|
|
|
|
@no int output,
|
|
@use tinyint output,
|
|
@item_code int output,
|
|
@item_count smallint output
|
|
as
|
|
set nocount on
|
|
|
|
SET @use = 0;
|
|
SET @no = 0;
|
|
SET @item_code = 0;
|
|
SET @item_count = 0;
|
|
|
|
select top 1
|
|
@no = [no],
|
|
@use = [use],
|
|
@item_code = [item_code],
|
|
@item_count = [item_count]
|
|
from [dbo].[Coupon] with (READUNCOMMITTED) where [coupon] = @coupon and [coupon_type] = @coupon_type
|
|
|
|
if ( @no <> 0 )
|
|
begin
|
|
--search
|
|
if( @use = 0 )
|
|
begin
|
|
--save
|
|
UPDATE [dbo].[Coupon] SET
|
|
[use] = 1,
|
|
[use_date] = @use_date,
|
|
[AuthID] = @auth_id,
|
|
[character_id] = @character_id,
|
|
[bcust_id] = @bcust_id,
|
|
[Name] = @character_name,
|
|
[IP] = @IP
|
|
where [coupon] = @coupon and [coupon_type] = @coupon_type;
|
|
|
|
SET @use = 2
|
|
end
|
|
end
|
|
|
|
select @no, @use, @item_code, @item_count
|
|
|
|
return @@error
|