ctgwglzc 发表于 2008-11-29 10:19:01

一个存储过程,来允许角色修改为中文名称

create   PROCEDURE .
@AccountID    varchar(21),
@Password    varchar(13),
@username       varchar(30),
@newname       varchar(30)
AS
DECLARE @Nation tinyint, @CharNum smallint,@kocount smallint,@chiefcount smallint
SET @Nation = 0
SET @CharNum = 0
SET @kocount = 0
DECLARE @pwd varchar(13),@item1 varchar(30),@item2 varchar(30),@item3 varchar(30)
DECLARE @chief varchar(30),@vicechief1 varchar(30),@vicechief2 varchar(30),@vicechief3 varchar(30)
SET @pwd = null
SELECT @pwd = strPasswd FROM . WHERE strAccountID = @AccountIDandidays>0;

SELECT @kocount = count(1) FROM . WHERE struserid = @newname ;
SELECT @chiefcount = count(1) FROM KNIGHTS WHERE chief=@username or vicechief_1=@username or vicechief_2=@username or vicechief_3=@username ;

select @item1=strcharid1,@item2=strcharid2,@item3=strcharid3from account_char where straccountid=@AccountID;

select @chief=chief,@vicechief1=vicechief_1,@vicechief2=vicechief_2,@vicechief3=vicechief_3from KNIGHTS
where chief=@username or vicechief_1=@username or vicechief_2=@username or vicechief_3=@username;


IF @pwd IS null
BEGIN
    --SET @nRet = 0
          --   SET @nRet = 4
    RETURN
END
ELSE IF @pwd <> @Password
BEGIN
    --SET @nRet = 0
         --SET @nRet = 3
    RETURN
END
begin
if @pwd = @Password and @kocount=0
begin
if @item1=@username
    --SET @nRet = 6
update account_char setstrcharid1=@newname   where straccountid=@AccountID;
else if @item2=@username
update account_char setstrcharid2=@newname   where straccountid=@AccountID;
else if @item3=@username
update account_char setstrcharid3=@newname   where straccountid=@AccountID;
end;
update userdata set struserid=@newname where struserid=@username;

begin

update KNIGHTS setchief=@newname   where chief=@username;

update KNIGHTS setvicechief_1=@newname   where vicechief_1=@username;

update KNIGHTS setvicechief_2=@newname   where vicechief_2=@username;

update KNIGHTS setvicechief_3=@newname   where vicechief_3=@username;
end;


end ;

GO

aiiq 发表于 2008-11-29 10:50:18

怎么用啊大哥

yangwx 发表于 2008-11-29 15:19:44

唉!还是不能在游戏里通过更名卷来改.................

luluji 发表于 2008-11-29 16:09:49

试试看看?

企业查询器那里复制入,F5运行

要用SA用户名运行

luluji 发表于 2008-11-29 16:14:19

还是没有啊

demon2k 发表于 2008-11-30 00:36:41

这个是不是在游戏中可以用改名卷改中文名了?

tianwei76 发表于 2008-12-4 10:54:59

我怎么试了无效啊。。。。。

xy305173481 发表于 2009-1-3 00:01:57

提示有错!
页: [1]
查看完整版本: 一个存储过程,来允许角色修改为中文名称