server-re/decomp/schema/RustyHearts_Log/procs/up_insert_log_gold.sql

66 lines
2.1 KiB
Transact-SQL

CREATE PROCEDURE [dbo].[up_insert_log_gold]
@server int,
@date datetime,
@AuthID [uniqueidentifier],
@CharID [uniqueidentifier],
@Name nvarchar(16),
@OtherAuthID [uniqueidentifier] = NULL,
@OtherCharID [uniqueidentifier] = NULL,
@OtherName nvarchar(16) = NULL,
@Type smallint,
@Gold_Prev int,
@Gold_Change int,
@Gold_After int,
@N1 nvarchar(16),
@N2 nvarchar(16)
as begin
set nocount on
-------------------------------------------------------
-- ?? ?? ?? DB? ???
declare @bcust_id nvarchar(30),
@bcust_id2 nvarchar(30)
set @bcust_id = ''
set @bcust_id2 = ''
declare @sql nvarchar(max)
set @sql = ' select top 1 @bcust_id = WindyCode from openquery([RustyHeartsLinkAuth]
, ''select top 1 WindyCode
from [RustyHearts_Auth].[dbo].[AuthTable]
where AuthID = '''''+convert(varchar(255),@AuthID)+''''''')'
select @sql
begin
-- select top 1 @bcust_id=WindyCode from [RustyHeartsLinkAuth].[berRustyHeartsAuth].[dbo].[AuthTable] where AuthID = @AuthID
exec dbo.sp_executesql @sql, N'@bcust_id nvarchar(30) output', @bcust_id output
select @bcust_id
if( @OtherAuthID <> '00000000-0000-0000-0000-000000000000' )
begin
set @sql = ' select top 1 @bcust_id2 = WindyCode from openquery([RustyHeartsLinkAuth]
, ''select top 1 WindyCode
from [RustyHearts_Auth].[dbo].[AuthTable]
where AuthID = '''''+convert(varchar(255),@OtherAuthID)+''''''')'
select @sql
exec dbo.sp_executesql @sql, N'@bcust_id2 nvarchar(30) output', @bcust_id2 output
select @bcust_id2
-- select top 1 @bcust_id2=WindyCode from [RustyHeartsLinkAuth].[berRustyHeartsAuth].[dbo].[AuthTable] where AuthID = @OtherAuthID
end
exec RustyHearts_Log.dbo.up_SetGold @Type, @server, @AuthID, @bcust_id, @CharID, @Name,
@OtherAuthID, @bcust_id2, @OtherCharID, @OtherName, @Gold_Prev, @Gold_Change, @Gold_After, @date
end
-------------------------------------------------------
end
/****** Object: StoredProcedure [dbo].[up_insert_log_guild] Script Date: 04/08/2011 23:12:18 ******/
SET ANSI_NULLS ON