CREATE PROCEDURE [dbo].[up_mail_item_move_sub] @item_id01 [uniqueidentifier], @page_01 int, @slot_01 int, @over_item_id01 [uniqueidentifier] as set nocount on declare @src_item_count int , @mail_item_count int declare @item_id [uniqueidentifier], @mail_item_id [uniqueidentifier], @charID [uniqueidentifier] set @src_item_count = 0 set @mail_item_count = 0 --메일 아이템을 얻어 온다 select @mail_item_id = [item_uid], @mail_item_count = [use_cnt], @charID = [character_id] from [dbo].[N_MailItem] with (READUNCOMMITTED) where item_uid = @item_id01 --인벤토리 아이템이 있는지 검사 select @item_id = [item_uid], @src_item_count = [use_cnt] from [dbo].[N_InventoryItem] with (READUNCOMMITTED) where item_uid = @over_item_id01 and page_index = @page_01 and slot_index = @slot_01 and character_id = @charID begin tran if @src_item_count > 0 begin --인벤토리에 존재하는 아이템 Update [dbo].[N_InventoryItem] set [use_cnt] = @mail_item_count + @src_item_count where [item_uid] = @item_id end else begin --인벤토리로 전체 이동 한다 insert [dbo].[N_InventoryItem] ([item_uid], [character_id], [auth_id], [page_index], [slot_index], [code], [use_cnt], [remain_time], [create_time], [update_time], [gcode], [durability], [enhance_level], [option_1_code], [option_1_value], [option_2_code], [option_2_value], [option_3_code], [option_3_value], [option_group], [ReconNum], [ReconState], [socket_count], [socket_1_code], [socket_1_value], [socket_2_code], [socket_2_value], [socket_3_code], [socket_3_value], [activity_value], --활성석 20100928 jojo [link_id], [socket_1_color], [socket_2_color], [socket_3_color], [rank], [acquireroute], [physical], [magical], [durabilitymax], [weight] ) select [item_uid], [character_id], [auth_id], @page_01, @slot_01, [code], [use_cnt], [remain_time], [create_time], [update_time], [gcode], [durability], [enhance_level], [option_1_code], [option_1_value], [option_2_code], [option_2_value], [option_3_code], [option_3_value], [option_group], [ReconNum], [ReconState], [socket_count], [socket_1_code], [socket_1_value], [socket_2_code], [socket_2_value], [socket_3_code], [socket_3_value], [activity_value], --활성석 20100928 jojo [link_id], [socket_1_color], [socket_2_color], [socket_3_color], [rank], [acquireroute], [physical], [magical], [durabilitymax], [weight] from [dbo].[N_MailItem] with (READUNCOMMITTED) where [item_uid] = @item_id01 end --메일 아이템 삭제 DELETE FROM [dbo].[N_MailItem] WHERE [item_uid] = @item_id01 declare @ERR int SET @ERR = @@ERROR IF @ERR <> 0 BEGIN RAISERROR('처리오류', 16, 10) IF @@TRANCOUNT <> 0 ROLLBACK RETURN (@ERR) END COMMIT TRAN