I’m using MySQL, of course.
However, I’m unable to run any while loop in the text box in the browser to update records in a table – I’m getting an error.
DECLARE @count INT
SET @count = 0
WHILE @count <2000 DO
/* loop logic in here */
SET @count = @count + 1;
END WHILE;
Is the above code wrong?
Here is the error:

MySQL said:
1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use
near ‘DECLARE @count INT SET @count = 0 WHILE @count <2000 DO
SET @count = @co’ at line 1
You can do this with a procedure like this :
mysql>call test();
Hope this help you.