請教各位以下問題~^^
以下是我執行的末日司令騎馬存儲- CREATE PROCEDURE WAR_CAPITAN
- @UserId varchar(21),
- @Nrow int
- AS DECLARE @Race int,@Nation int
- Select @Race = Race From USERDATA Where strUserId = @UserId
- Select @Nation = Nation From USERDATA Where strUserId = @UserId
- --Ata Bin IF @Race = 1 and @Nrow = 1
- BEGIN Update USERDATA Set Race = 5 Where strUserId = @UserId
- END
- ELSE IF @Race = 2 and @Nrow = 1
- BEGIN Update USERDATA Set Race = 6 Where strUserId = @UserId
- END
- ELSE IF @Race = 3 and @Nrow = 1
- BEGIN Update USERDATA Set Race = 7 Where strUserId = @UserId
- END
- ELSE IF @Race = 4 and @Nrow = 1
- BEGIN Update USERDATA Set Race = 8 Where strUserId = @UserId
- END
- ELSE IF @Race = 11 and @Nrow = 1
- BEGIN Update USERDATA Set Race = 14 Where strUserId = @UserId
- END
- ELSE IF @Race = 12 and @Nrow = 1
- BEGIN Update USERDATA Set Race = 15 Where strUserId = @UserId
- END
- ELSE IF @Race = 13 and @Nrow = 1
- BEGIN Update USERDATA Set Race = 16 Where strUserId = @UserId
- END
- --Attan In
- IF @Race = 5 and @Nrow = 2
- BEGIN Update USERDATA Set Race = 1 Where strUserId = @UserId
- END
- ELSE IF @Race = 6 and @Nrow = 2
- BEGIN Update USERDATA Set Race = 2 Where strUserId = @UserId
- END
- ELSE IF @Race = 7 and @Nrow = 2
- BEGIN Update USERDATA Set Race = 3 Where strUserId = @UserId
- END
- ELSE IF @Race = 8 and @Nrow = 2
- BEGIN Update USERDATA Set Race = 4 Where strUserId = @UserId
- END
- ELSE IF @Race = 14 and @Nrow = 2
- BEGIN Update USERDATA Set Race = 11 Where strUserId = @UserId
- END
- ELSE IF @Race = 15 and @Nrow = 2
- BEGIN Update USERDATA Set Race = 12 Where strUserId = @UserId
- END
- ELSE IF @Race = 16 and @Nrow = 2
- BEGIN Update USERDATA Set Race = 13 Where strUserId = @UserId
- END
- GO
- Go to Update_User_Data and look for
- WHERE strUserId = @id and add this :
- DECLARE @Neo int
- Select @Neo = Count(*) From USERDATA Where Zone = @Zone
- IF @Zone = 102 and @Nation = 1 and @Neo < 6
- BEGIN Exec WAR_CAPITAN @id , '1'
- END
- ELSE IF @Zone = 102 and @Nation = 2 and @Neo < 6
- BEGIN Exec WAR_CAPITAN @id , '1'
- 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'。 |