Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- ================================================
- -- Template generated from Template Explorer using:
- -- Create Procedure (New Menu).SQL
- --
- -- Use the Specify Values for Template Parameters
- -- command (Ctrl-Shift-M) to fill in the parameter
- -- values below.
- --
- -- This block of comments will not be included in
- -- the definition of the procedure.
- -- ================================================
- SET ANSI_NULLS ON
- GO
- SET QUOTED_IDENTIFIER ON
- GO
- -- =============================================
- -- Author: <Author,,Name>
- -- Create date: <Create Date,,>
- -- Description: <Description,,>
- -- =============================================
- CREATE PROCEDURE _GenderSwitch
- -- Add the parameters for the stored procedure here
- @CharID INT
- ,@ItemrefID INT
- AS
- SET NOLOCK,XACT_ABORT ON
- BEGIN transaction
- begin try
- DECLARE @Item INT
- SELECT TOP 1 @Item = I.refitemid
- from SRO_VT_SH.._Items I with (nolock)
- JOIN SRO_VT_SH.._Inventory N with (nolock)
- on I.ID64=N.ItemID
- WHERE N.CharID = @CharID and N.Slot = 13 and N.ItemID > 0
- IF @Item is null or @Item = 0 or @Item not in (select RefItemIDA from ItemSwitch with (nolock)) or @Item not in (select refitemidb from ItemSwitch with (nolock))
- BEGIN
- ROLLBACK TRANSACTION
- RETURN 0;
- END
- DECLARE @NEWITEM INT
- SELECT @NEWITEM = case
- when @Item in (select refitemida from ItemSwitch with (nolock)) then (select top 1 refitemidb from ItemSwitch WITH (NOLOCK) where ScrollID = @ItemrefID and RefItemIDA = @Item)
- else (select top 1 refitemida from ItemSwitch with (nolock) where ScrollID = @ItemrefID and RefItemIDB = @Item)
- end
- UPDATE I
- SET RefItemID = @NEWITEM
- from SRO_VT_SH.._Items i
- join sro_vt_sh.._Inventory n
- on i.ID64 = n.ItemID
- where n.charid = @CharID and n.slot=13
- return 1;
- END try
- begin catch
- ERRORHANDLER:
- rollback transaction
- return -1
- end catch
- commit transaction
- GO
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement