Code:
USE [VANDOM_SYSTEMS]
GO
/****** Object: StoredProcedure [dbo].[MODEL_D11] Script Date: 8/5/2019 12:16:15 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author: <Author,,Name>
-- Create date: <Create Date,,>
-- Description: <Description,,>
-- =============================================
ALTER PROCEDURE [dbo].[MODEL_D11]
@CharID int
AS
DECLARE @CHARNAME varchar(129)
DECLARE @OLD_CODE varchar(129)
DECLARE @NEW_CODE varchar(129)
DECLARE @NEW_ITEM_ID int
DECLARE @date datetime
SET @date = GETDATE()
SET @CHARNAME = (SELECT CharName16 from SR_R_Shard1.._Char where CharID = @CharID)
SELECT @OLD_CODE = Codename128 from SR_R_Shard1.._RefObjCommon WHERE ID =
(SELECT RefItemID from SR_R_Shard1.._Items where ID64 =
(SELECT ItemID from SR_R_Shard1.._Inventory where CharID = @CharID and Slot = '13'))
SET @NEW_CODE = @OLD_CODE+'_D11'
IF (SELECT ID from SR_R_Shard1.._RefObjCommon where Codename128 = @NEW_CODE) > '1'
BEGIN
SELECT @NEW_ITEM_ID = ID from SR_R_Shard1.._RefObjCommon where Codename128 = @NEW_CODE
UPDATE SR_R_Shard1.._Items
SET RefItemID = @NEW_ITEM_ID where ID64 =
(SELECT ItemID from SR_R_Shard1.._Inventory where CharID = @CharID and Slot = '13')
END