declare @CID as int 
declare @Count as int
declare @Name as varchar(16)

declare cursor1 cursor for

Select CID, Name From CharInfo

open cursor1 

FETCH NEXT FROM cursor1 INTO @CID, @Name

WHILE @@FETCH_STATUS = 0

BEGIN

Set @Count = (Select Count(*) From Part2_DB.dbo.CharInfo Where Part2_DB.dbo.CharInfo.Name = @Name)

if @Count <> 0 And len(@Name) < 15

Begin

Update CharInfo Set Name = @Name + '0'  Where CID = @CID
Update TblUnifiedCharList Set BeforeCharName = @Name + '0'  Where BeforeCID = @CID

Update CharInfoEx Set NameChangeCount = 1 Where CID = @CID

End

FETCH NEXT FROM cursor1 INTO @CID, @Name

End

CLOSE cursor1

DEALLOCATE cursor1

sp_help TblUnifiedCharList