0

I am trying to execute following mySql statement

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

in SQL Server 2005 like

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

it gives error like

"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 command

2
  • 1
    Check here: sql-server-helper.com/error-messages/msg-136.aspx - it should cover your question Commented Nov 20, 2012 at 7:37
  • 1
    You can't just type MySQL commands into SQL Server and expect them to work. It would help if you explain what DECLARE CONTINUE HANDLER actually does (or link to the docs), for the benefit of SQL Server people who may not be familiar with MySQL. Commented Nov 20, 2012 at 13:44

1 Answer 1

2

SQL Server has no direct equivalent of the handler mechanism described in the documentation linked above. The most obvious alternatives are:

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.