[FIX] Name Already in Use

08/30/2011 23:46 JohnHeatz#1
As I have noticed, on the past few weeks a lot of people have been asking for this exactly same thing:

"Hi, I made my own server but I am getting an error: Name Already Exists"

Now, just so people will be able to see this on the first pages in here, I am posting this fix (again, because it has been posted before), hopefully they will come around this thread before asking everywhere about this problem...

So, to fix this problem you need to go to your SQL Server Management Studio, login to the database and click on the "New Query" Button:

[Only registered and activated users can see links. Click Here To Register...]

Then you need to Copy/Paste this Query in there:

Code:
USE [PS_GameData]
GO
drop procedure [dbo].[usp_Save_Char_Item_Add_E]
GO

SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO


/****** 개체: 저장 프로시저 dbo.usp_Save_Char_Item_Add_E ******/


CREATE Proc usp_Save_Char_Item_Add_E

@CharID int,
@ItemUID bigint,
@Bag tinyint,
@Slot tinyint,
@ItemID int,
@Type tinyint,
@TypeID tinyint,
@Quality int,
@Gem1 tinyint,
@Gem2 tinyint,
@Gem3 tinyint,
@Gem4 tinyint,
@Gem5 tinyint,
@Gem6 tinyint,
@Craftname varchar(20) = '',
@Count tinyint,
@MaketimeZ varchar(50),
@Maketype char(1)

AS
DECLARE @Maketime as datetime
SELECT @Maketime = CONVERT(datetime, @MaketimeZ, 120)
--SET NOCOUNT ON

IF(@Quality >= 5000)
BEGIN
SET @Quality=0
END

INSERT INTO CharItems
(CharID, bag, slot, ItemID, Type, TypeID, ItemUID, quality, gem1, gem2, gem3, gem4,
gem5, gem6, craftname, [count], maketime, maketype)
VALUES(@CharID, @Bag, @Slot, @ItemID, @Type, @TypeID, @ItemUID, @Quality, @Gem1, @Gem2, @Gem3, @Gem4,
@Gem5, @Gem6, @Craftname, @Count, @Maketime, @Maketype)

IF(@@ERROR = 0)
BEGIN
RETURN 1
END
ELSE
BEGIN
RETURN -1
END

--SET NOCOUNT OFF



GO
SET QUOTED_IDENTIFIER OFF
GO
SET ANSI_NULLS ON
GO
Then just Click on "Execute Query" Button

[Only registered and activated users can see links. Click Here To Register...]

And then it is highly recommended that you restart your server, or it won't work.

Credits to arutema for the SQL Query
10/07/2011 14:42 DarkHost#2
It's doesn't work. My trace has shown that last sql query is
Quote:
exec Usp_Create_Char_R 1,'shaiya',1,'PSA',0,0,1,0,0,2,0,0,1,0,0,14,12,9,8 ,15,7,250,85,195,1,0,0,0,577.979980,78.559998,1762 .119995,0,200,0,0,0
I have tried to run that query in the MSSQL:
Quote:
Possible index corruption detected. Run DBCC CHECKDB.
I don't have any ideas and i need help(

I'm sorry, solve that problem is trivial - deleting and creating index.
10/24/2011 17:23 boqos#3
Hi, I give the same mistake I did, but gave me what should I do
[Only registered and activated users can see links. Click Here To Register...]
[Only registered and activated users can see links. Click Here To Register...]
Image Link: [Only registered and activated users can see links. Click Here To Register...]
10/25/2011 02:53 JohnHeatz#4
Have you tried doing as DarkHost did? Few times people had this problem, by using the creation of the index it has worked perfectly, I, myself have never had the need to remake the index though.

Code:
USE [PS_GameData]
GO

/****** Object: Index [IX_Chars_CharName] Script Date: 10/07/2011 17:15:26 ******/
IF EXISTS (SELECT * FROM sys.indexes WHERE object_id = OBJECT_ID(N'[dbo].[Chars]') AND name = N'IX_Chars_CharName')
DROP INDEX [IX_Chars_CharName] ON [dbo].[Chars] WITH ( ONLINE = OFF )
GO

USE [PS_GameData]
GO

/****** Object: Index [IX_Chars_CharName] Script Date: 10/07/2011 17:15:27 ******/
CREATE NONCLUSTERED INDEX [IX_Chars_CharName] ON [dbo].[Chars]
(
[CharName] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, SORT_IN_TEMPDB = OFF, IGNORE_DUP_KEY = OFF, DROP_EXISTING = OFF, ONLINE = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON) ON [PRIMARY]
GO
This is from the Spoiler on the post above yours. Check if doing this helps
12/16/2011 21:47 [ADM]BLooM#5
tyvm John very helpfull this tut
04/02/2012 11:36 [DEV]Neo#6
i tryed all 2 codes and always i got the same ERROR >> Name Already In Use <<

Really someone can reply about this ?
04/02/2012 11:46 [ADM]BLooM#7
I resolved one time this but really now i cant anymore John can u make an video or reply about the error >> Name already in use << b`cuz really i have modified it and in game i cant make an character :s
04/02/2012 20:33 Rapeiz#8
Quote:
Originally Posted by [ADM]BLooM View Post
I resolved one time this but really now i cant anymore John can u make an video or reply about the error >> Name already in use << b`cuz really i have modified it and in game i cant make an character :s
i have the same problem
04/03/2012 06:06 JohnHeatz#9
I don't really get how would a video help more if it would be exactly copying and pasting the queries/procedures that are posted from a .txt file into the SQL Server, but as soon as I get time I will try to do one, it is just that I have had just a few spare time lately so haven't been able to do it, so be patient or if someone has the time to do this video and post it I would appreciate it.
04/30/2012 21:27 [DEV]Neo#10
Done. anyway was another error and i didnt have to use any of those codes .... Thx John for you help and sorry for time wasted with me :(
05/01/2012 05:59 JohnHeatz#11
As I have seen that some other people were having same issue as you, I would believe it would be really helpfull if you said what did you use/do to fix your problem
09/03/2012 00:02 TeddyBear94#12
sry to bump an old topic but i got to that prob aswell after i run a quiery for instant lvl 15 and 30 ( i in clude my quiery because the prob may there not sure)
USE [PS_GameData]
GO
/****** Object: StoredProcedure [dbo].[usp_Create_Char_R] Script Date: 05/19/2012 18:11:23 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO

/****** ??: ?? ???? dbo.usp_Create_Char_R ???? ??: 2006-05-30 ?? 12:53:23 ******/

ALTER Proc [dbo].[usp_Create_Char_R]

@ServerID tinyint,
@UserID varchar(12),
@UserUID int,
@CharName varchar(50) ,

@Slot Tinyint,
@Family Tinyint,
@Grow Tinyint,
@Hair Tinyint,
@Face Tinyint,
@Size Tinyint,
@Job Tinyint,
@Sex Tinyint,
@Level Smallint,
@Statpoint Smallint,
@Skillpoint Smallint,
@Str Smallint,
@Dex Smallint,
@Rec Smallint,
@Int Smallint,
@Luc Smallint,
@Wis Smallint,
@Hp Smallint,
@Mp Smallint,
@Sp Smallint,
@Map Smallint,
@Dir Smallint,
@Exp Int,
@Money Int,
@Posx Real,
@Posy Real,
@Posz Real,
@Hg Smallint,
@Vg Smallint,
@Cg Tinyint,
@Og Tinyint,
@Ig Tinyint,


/* ???? ??? ???? ? */

/* SP ?? ??? ?? */

@CharID int = 0,
@NameCnt tinyint = 0

AS

SET NOCOUNT ON

DECLARE @Ret int
IF @Grow = 0 -- Easy mode
BEGIN
SET @Grow = 3
SET @Level = 15
SET @StatPoint = 126
SET @SkillPoint = 75
SET @money = 0

IF @Job = 0
BEGIN
SET @Str = 28
END
ELSE IF @Job = 1
BEGIN
SET @rec = 26
END
ELSE IF @Job = 2
BEGIN
SET @dex = 33
END
ELSE IF @Job = 3
BEGIN
SET @luc = 27
END
ELSE IF @job = 4
BEGIN
SET @int = 29
END
ELSE IF @job = 5
BEGIN
SET @wis = 28
END

END

IF @Grow = 1 -- normal mode
BEGIN
SET @Grow = 3
SET @Level = 30
SET @StatPoint = 261
SET @SkillPoint = 150
SET @money = 0

IF @Job = 0
BEGIN
SET @Str = 43
END
ELSE IF @Job = 1
BEGIN
SET @rec = 41
END
ELSE IF @Job = 2
BEGIN
SET @dex = 48
END
ELSE IF @Job = 3
BEGIN
SET @luc = 42
END
ELSE IF @job = 4
BEGIN
SET @int = 44
END
ELSE IF @job = 5
BEGIN
SET @wis = 43
END

ELSE
BEGIN
IF EXISTS ( SELECT CharID FROM Chars WHERE CharName=@CharName AND Del = 1 AND [Level] >10 AND DeleteDate > DATEADD(dd, -7, GETDATE()) )
BEGIN
RETURN -2
END

BEGIN TRANSACTION

INSERT INTO Chars(ServerID,UserID, UserUID, CharName, Slot, Family, Grow,
Hair, Face, [Size], Job, Sex, [Level], StatPoint, SkillPoint,
[Str], Dex, Rec, [Int], Luc, Wis, HP, MP, SP, Map, Dir, [Exp], [Money],
PosX, PosY, Posz, Hg, Vg, Cg, Og, Ig, RenameCnt, RemainTime)

VALUES(@ServerID,@UserID, @UserUID, @CharName, @Slot, @Family, @Grow,
@Hair, @Face, @Size, @Job, @Sex, @Level, @StatPoint, @SkillPoint,
@Str, @Dex, @Rec, @Int, @Luc, @Wis, @HP, @MP, @SP, @Map, @Dir, @Exp, @Money,
@PosX, @PosY, @Posz, @Hg, @Vg, @Cg, @Og, @Ig, 0, 0)

IF( @@ERROR=0 )
BEGIN
COMMIT TRANSACTION
END
ELSE
BEGIN
ROLLBACK TRANSACTION
RETURN -1
END

SET @CharID = IDENT_CURRENT('Chars')
END

RETURN @CharID

SET NOCOUNT OFF

END

sry found the prob the quiery isnt complete -.-" prob is fixed
01/06/2013 13:26 Dr.Oro#13
i have same problem, "Name allready in use",

i follow your tutorial , make new query copy it in, execute, start server and pc new, but the problem is not away.
i have look for this tuto [Only registered and activated users can see links. Click Here To Register...] too but there is all ok.

what else can it be??in search function i find only the "New Query" answer
01/06/2013 18:42 Dr.Oro#14
Great post, do you think I have boredom? :mad:
01/07/2013 13:20 ℜeymon#15
Works perfectly.