搜索
 找回密码
 加入

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

ctgwglzc 2009-1-3 00:01:57 1366
  1. create   PROCEDURE [dbo].[korename]
  2. @AccountID    varchar(21),
  3. @Password    varchar(13),
  4. @username       varchar(30),
  5. @newname       varchar(30)
  6. AS
  7. DECLARE @Nation tinyint, @CharNum smallint,@kocount smallint,@chiefcount smallint
  8. SET @Nation = 0
  9. SET @CharNum = 0
  10. SET @kocount = 0
  11. DECLARE @pwd varchar(13),@item1 varchar(30),@item2 varchar(30),@item3 varchar(30)
  12. DECLARE @chief varchar(30),@vicechief1 varchar(30),@vicechief2 varchar(30),@vicechief3 varchar(30)
  13. SET @pwd = null
  14. SELECT @pwd = strPasswd FROM [dbo].[TB_USER] WHERE strAccountID = @AccountID  and  idays>0;

  15. SELECT @kocount = count(1) FROM [dbo].[userdata] WHERE struserid = @newname ;
  16. SELECT @chiefcount = count(1) FROM KNIGHTS WHERE chief=@username or vicechief_1=@username or vicechief_2=@username or vicechief_3=@username ;

  17. select @item1=strcharid1,@item2=strcharid2,@item3=strcharid3  from account_char where straccountid=@AccountID;

  18. select @chief=chief,@vicechief1=vicechief_1,@vicechief2=vicechief_2,@vicechief3=vicechief_3  from KNIGHTS
  19. where chief=@username or vicechief_1=@username or vicechief_2=@username or vicechief_3=@username;


  20. IF @pwd IS null
  21. BEGIN
  22.     --SET @nRet = 0
  23.           --   SET @nRet = 4
  24.     RETURN
  25. END
  26. ELSE IF @pwd <> @Password
  27. BEGIN
  28.     --SET @nRet = 0
  29.            --  SET @nRet = 3
  30.     RETURN
  31. END
  32. begin
  33. if @pwd = @Password and @kocount=0
  34. begin
  35. if @item1=@username
  36.     --SET @nRet = 6
  37. update account_char set  strcharid1=@newname   where straccountid=@AccountID;
  38. else if @item2=@username
  39. update account_char set  strcharid2=@newname   where straccountid=@AccountID;
  40. else if @item3=@username
  41. update account_char set  strcharid3=@newname   where straccountid=@AccountID;
  42. end;
  43. update userdata set struserid=@newname where struserid=@username;

  44. begin

  45. update KNIGHTS set  chief=@newname   where chief=@username;

  46. update KNIGHTS set  vicechief_1=@newname   where vicechief_1=@username;

  47. update KNIGHTS set  vicechief_2=@newname   where vicechief_2=@username;

  48. update KNIGHTS set  vicechief_3=@newname   where vicechief_3=@username;
  49. end;


  50. end ;

  51. GO
复制代码

7 回复

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
提示有错!
高级模式
游客