SQL query working from cmd-line doesn't work in HeidiSQL

johnnyontheweb's profile image johnnyontheweb posted 4 years ago in HeidiSQL portable Permalink

Hello, I have a simple SQL query, working from cmd-line, that doesn't work in HeidiSQL 11.2 (and all previous):

SET @x = 20; REPEAT INSERT INTO table(cols) VALUES ('test') SET @x=@x-1 UNTIL @x <= 0 END REPEAT

I get this error: Errore SQL (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 'REPEAT INSERT INTO serials(serial) VALUES ('10') SET @x=@x-1 U' at line 1

I tried also inserting ";" as delimiter after every line (in almost every combination...), but nothing changes.

This is strange that it's working perfectly in mysql command-line.

Anyone can help? thanks

ansgar's profile image ansgar posted 4 years ago Permalink

REPEAT belongs to the compound statements, which work in procedures and functions, but not in normal queries as far as I know. I may be wrong, when you say it works in MySQL cli, but I wonder why the server rejects it then in HeidiSQL.

Please login to leave a reply, or register at first.