40 lines
1 KiB
Transact-SQL
40 lines
1 KiB
Transact-SQL
CREATE PROCEDURE [dbo].[up_insert_inquiry_by_gm]
|
|
@type tinyint,
|
|
@character_name nvarchar(16),
|
|
@memo nvarchar(255),
|
|
@compulsion tinyint
|
|
as
|
|
set nocount on
|
|
|
|
declare @auth_id uniqueidentifier
|
|
declare @character_id uniqueidentifier
|
|
declare @bcust_id nvarchar(50)
|
|
declare @count tinyint
|
|
|
|
set @bcust_id = ''
|
|
|
|
select @auth_id = [AuthID], @character_id = [character_id], @bcust_id = RTRIM(bcust_id) from [dbo].[CharacterTable] with (READUNCOMMITTED) where [Name] = @character_name
|
|
select @count = [InquiryCount] from [RustyHearts_Auth].[dbo].[AuthTable] with (READUNCOMMITTED) where [AuthID] = @auth_id
|
|
|
|
set xact_abort on
|
|
|
|
if NOT EXISTS ( select @character_id from [dbo].[InquiryTable] with (READUNCOMMITTED) where [character_id] = @character_id )
|
|
begin
|
|
insert into InquiryTable
|
|
values
|
|
(
|
|
@auth_id,
|
|
@character_id,
|
|
@type,
|
|
@character_name,
|
|
@bcust_id,
|
|
@count,
|
|
@memo,
|
|
@compulsion,
|
|
GETDATE()
|
|
);
|
|
end
|
|
|
|
select * from [dbo].[InquiryTable] with (READUNCOMMITTED) where character_id = @character_id
|
|
|
|
return @@error
|