chencjh 发表于 2009-4-23 08:29:43

在线改名储存过程

CREATE PROCEDURE CHANGE_NEW_ID
@byType char(21),
@AccountID char(21),
@OldCharID char(21),
@NewCharID char(21),
@nRet smallint output
AS
/*
Author : AKUMA
*/
DECLARE @CheckUserID int
SELECT @CheckUserID = COUNT(strUserID) FROM USERDATA WHERE strUserID = @NewCharID
IF @CheckUserID = 0
BEGIN
-- Change Account All Information
UPDATE ACCOUNT_CHAR SET strCharID1 = @NewCharID WHERE strCharID1 = @OldCharID AND strCharID1 is not null
UPDATE ACCOUNT_CHAR SET strCharID2 = @NewCharID WHERE strCharID2 = @OldCharID AND strCharID2 is not null
UPDATE ACCOUNT_CHAR SET strCharID3 = @NewCharID WHERE strCharID3 = @OldCharID AND strCharID3 is not null
UPDATE USERDATA SET strUserId = @NewCharID WHERE strUserId = @OldCharID AND strUserId is not null
-- Change Information a User in Knights
UPDATE KNIGHTS_USER SET strUserId = @NewCharID WHERE strUserId = @OldCharID AND strUserIdis not null
UPDATE KNIGHTS SET Chief = @NewCharID WHERE Chief = @OldCharID AND Chief is not null
UPDATE KNIGHTS SET ViceChief_1 = @NewCharID WHERE ViceChief_1 = @OldCharID AND ViceChief_1 is not null
UPDATE KNIGHTS SET ViceChief_2 = @NewCharID WHERE ViceChief_2 = @OldCharID AND ViceChief_2 is not null
UPDATE KNIGHTS SET ViceChief_3 = @NewCharID WHERE ViceChief_3 = @OldCharID AND ViceChief_3 is not null
-- Change Information a User is King
UPDATE KING_SYSTEM SET strKingName = @NewCharID WHERE strKingName = @OldCharID AND strKingName is not null
UPDATE KING_ELECTION_LIST SET strName = @NewCharID WHERE strName = @OldCharID AND strName is not null
-- Change User Friend List Information
UPDATE FRIEND_LIST SET strUserID = @NewCharID where strUserID = @OldCharID
-- User Rental Item
UPDATE RENTAL_ITEM SET strLenderCharID = @NewCharID WHERE strLenderCharID = @OldCharID AND strLenderCharID is not null
UPDATE RENTAL_ITEM SET strBorrowerCharID = @NewCharID WHERE strBorrowerCharID = @OldCharID AND strBorrowerCharID is not null
UPDATE RENTAL_ITEM_LIST SET strBorrowerCharID = @NewCharID WHERE strBorrowerCharID = @OldCharID AND strBorrowerCharID is not null
-- Change CurrentUser
UPDATE CURRENTUSER SET strCharID = @NewCharID WHERE strCharID = @OldCharID
-- Name Change is Sucessfull
SET @nRet = 0
RETURN
END
ELSE
BEGIN
-- Entered ID is Already Being Used Another Character
SET @nRet = 1
RETURN
END

GO

wang9898 发表于 2009-8-20 23:56:46

在线改名有复制漏洞,最好是判断玩家下线了才给改名

ming9413 发表于 2009-11-9 14:44:06

学习了~

duepbbmal336 发表于 2009-11-30 09:47:40

3# wery0712


这个要顶下好东西啊

leonjaykai 发表于 2010-1-12 16:27:26

請問樓主這是用於那個存儲表?謝謝

zzy51521 发表于 2010-1-30 17:51:50

谢谢LZ了............
页: [1]
查看完整版本: 在线改名储存过程