0

我正在尝试执行以下 mySql 语句

"DECLARE DONE INT(1) default 0;    
DECLARE CONTINUE HANDLER FOR NOT FOUND SET DONE = 1;" 

在 SQL Server 2005 中

" DECLARE @DONE INT,    
DECLARE CONTINUE HANDLER FOR NOT FOUND SET DONE = 1" 

它给出了类似的错误

"Msg 156, Level 15, State 1, Line 1
Incorrect syntax near the keyword 'CONTINUE'.
Msg 136, Level 15, State 1, Line 1
Cannot use a CONTINUE statement outside the scope of a WHILE statement."

MySQL DECLARE ... HANDLER 命令

4

1 回答 1

2

SQL Server 没有直接等效于上面链接的文档中描述的处理程序机制。最明显的替代方案是:

于 2012-11-20T15:01:07.880 回答