كود:
USE [SRO_VT_SHARDLOG]
GO
/****** Object: StoredProcedure [dbo].[_AddLogChar] Script Date: 18-Aug-16 4:06:45 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER procedure [dbo].[_AddLogChar]
@CharID int,
@EventID tinyint,
@Data1 int,
@Data2 int,
@strPos varchar(64),
@Desc varchar(128)
as
If @EventID = 6 and exists (select * from sro_vt_shard.._charcos where ownercharid = @CharID and refcharid in (select id from sro_vt_shard.._refobjcommon where codename128 like '%COS_T%'))
begin
update SRO_VT_SHARD.._InvCOS set itemid = 0
where COSID = (select id from sro_vt_shard.._CharCOS where OwnerCharID = @CharID and RefCharID in (select id from sro_vt_Shard.._RefObjCommon where codename128 like '%COS_T%'))
update SRO_VT_SHARD.dbo._CharCOS set ownercharid = 0
where
OwnerCharID = @CharID and RefCharID in (select id from SRO_VT_SHARD.._RefObjCommon where CodeName128 like '%COS_T%')
END
declare @len_pos int
declare @len_desc int
set @len_pos = len(@strPos)
set @len_desc = len(@Desc)
if (@len_pos > 0 and @len_desc > 0)
begin
insert _LogEventChar values(@CharID, GetDate(), @EventID, @Data1, @Data2, @strPos, @Desc)
end
else if (@len_pos > 0 and @len_desc = 0)
begin
insert _LogEventChar (CharID, EventTime, EventID, Data1, Data2, EventPos) values(@CharID, GetDate(), @EventID, @Data1, @Data2, @strPos)
end
else if (@len_pos = 0 and @len_desc > 0)
begin
insert _LogEventChar (CharID, EventTime, EventID, Data1, Data2, strDesc) values(@CharID, GetDate(), @EventID, @Data1, @Data2, @Desc)
end
else
begin
insert _LogEventChar (CharID, EventTime, EventID, Data1, Data2) values(@CharID, GetDate(), @EventID, @Data1, @Data2)
end