Code:
USE [SRO_VT_ACCOUNT]
GO
/****** Object: Table [dbo].[SR_CharAppoint] Script Date: 10/29/2011 10:50:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
CREATE TABLE [dbo].[SR_CharAppoint](
[UserJID] [int] NOT NULL,
[ShardID] [int] NOT NULL,
[CharID] [varchar](64) COLLATE SQL_Latin1_General_CP1_CI_AS NOT NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
Just add this new table and change the _ManageShardCharNames procedure:
Code:
set ANSI_NULLS OFF
set QUOTED_IDENTIFIER OFF
GO
ALTER procedure [dbo].[_ManageShardCharName]
@job tinyint,
@UserJID int,
@ShardID smallint,
@CharName varchar(64),
@OldName varchar(64)
as
-- add new char name
if (@job = 0)
begin
if (not exists(select * from SR_ShardCharNames where UserJID = @UserJID and ShardID = @ShardID and CharName = @CharName))
begin
insert SR_ShardCharNames values(@UserJID, @ShardID, @CharName)
end
end
-- remove char name
else if (@job = 1)
begin
delete SR_ShardCharNames where UserJID = @UserJID and ShardID = @ShardID and CharName = @CharName
delete SR_CharAppoint where UserJID = @UserJID and ShardID = @ShardID and CharID = @CharName
end
-- rename previous one
else if (@job = 2)
begin
update SR_ShardCharNames set CharName = @CharName where UserJID = @UserJID and ShardID = @ShardID and CharName = @OldName
update SR_CharAppoint set CharID = @CharName where UserJID = @UserJID and ShardID = @ShardID and CharID = @OldName
end
that's all.