搜索
 找回密码
 加入

請教ct 在執行末日戰場司令騎馬補丁出現問題

leonjaykai 2010-7-18 11:11:58 1649
請教各位以下問題~^^


以下是我執行的末日司令騎馬存儲
  1. CREATE PROCEDURE WAR_CAPITAN
  2. @UserId varchar(21),
  3. @Nrow int
  4. AS DECLARE @Race int,@Nation int

  5. Select @Race = Race From USERDATA Where strUserId = @UserId
  6. Select @Nation = Nation From USERDATA Where strUserId = @UserId

  7. --Ata Bin IF @Race = 1 and @Nrow = 1
  8. BEGIN Update USERDATA Set Race = 5 Where strUserId = @UserId
  9. END   
  10. ELSE IF @Race = 2 and @Nrow = 1
  11. BEGIN Update USERDATA Set Race = 6 Where strUserId = @UserId
  12. END   
  13. ELSE IF @Race = 3 and @Nrow = 1
  14. BEGIN Update USERDATA Set Race = 7 Where strUserId = @UserId
  15. END   
  16. ELSE IF @Race = 4 and @Nrow = 1
  17. BEGIN Update USERDATA Set Race = 8 Where strUserId = @UserId
  18. END   
  19. ELSE IF @Race = 11 and @Nrow = 1
  20. BEGIN Update USERDATA Set Race = 14 Where strUserId = @UserId
  21. END
  22. ELSE IF @Race = 12 and @Nrow = 1
  23. BEGIN Update USERDATA Set Race = 15 Where strUserId = @UserId
  24. END
  25. ELSE IF @Race = 13 and @Nrow = 1
  26. BEGIN Update USERDATA Set Race = 16 Where strUserId = @UserId
  27. END
  28. --Attan In
  29. IF @Race = 5 and @Nrow = 2
  30. BEGIN Update USERDATA Set Race = 1 Where strUserId = @UserId
  31. END   
  32. ELSE IF @Race = 6 and @Nrow = 2
  33. BEGIN Update USERDATA Set Race = 2 Where strUserId = @UserId
  34. END   
  35. ELSE IF @Race = 7 and @Nrow = 2
  36. BEGIN Update USERDATA Set Race = 3 Where strUserId = @UserId
  37. END   
  38. ELSE IF @Race = 8 and @Nrow = 2
  39. BEGIN Update USERDATA Set Race = 4 Where strUserId = @UserId
  40. END   
  41. ELSE IF @Race = 14 and @Nrow = 2
  42. BEGIN Update USERDATA Set Race = 11 Where strUserId = @UserId
  43. END
  44. ELSE IF @Race = 15 and @Nrow = 2
  45. BEGIN Update USERDATA Set Race = 12 Where strUserId = @UserId
  46. END
  47. ELSE IF @Race = 16 and @Nrow = 2
  48. BEGIN Update USERDATA Set Race = 13 Where strUserId = @UserId
  49. END

  50. GO

  51. Go to Update_User_Data and look for

  52. WHERE    strUserId    = @id and add this :
  53. DECLARE @Neo int
  54. Select @Neo = Count(*) From USERDATA Where Zone = @Zone

  55. IF @Zone = 102 and @Nation = 1 and @Neo < 6
  56. BEGIN Exec WAR_CAPITAN @id , '1'
  57. END
  58. ELSE IF @Zone = 102 and @Nation = 2 and @Neo < 6
  59. BEGIN Exec WAR_CAPITAN @id , '1'
  60. END
复制代码
run this to execute :
Exec WAR_CAPITAN 'Ingame Name' ,'1'

Exec WAR_CAPITAN 'Ingame Name','2'

以下是出現的錯誤訊息

/*-----------------------------
CREATE PROCEDURE WAR_CAPITAN
@UserId varchar(21),
@Nrow int
-----------------------------*/
Server: Msg 156, Level 15, State 1, Procedure WAR_CAPITAN, Line 12
在关键字 'ELSE' 附近有语法错误。
Server: Msg 156, Level 15, State 1, Line 2
在关键字 'to' 附近有语法错误。
Server: Msg 137, Level 15, State 1, Line 6
必须声明变量 '@Zone'。
Server: Msg 137, Level 15, State 1, Line 8
必须声明变量 '@Zone'。
Server: Msg 137, Level 15, State 1, Line 9
必须声明变量 '@id'。
Server: Msg 137, Level 15, State 1, Line 11
必须声明变量 '@Zone'。
Server: Msg 137, Level 15, State 1, Line 12
必须声明变量 '@id'。

3 回复

leonjaykai
2010-3-17 11:34:33
楼主
点击查看详情
請問toto 可否發給我完整的存儲或指導一下要增加那些數據?  謝謝
wang9898
2010-3-19 00:02:57
sql存储过程有问题,检查一下哪里语法不对,或者是不是使用了非英文的字符。
维护世界和平
2010-7-18 11:11:58
这个问题。。。是个问题
高级模式
游客