Error while export 2

[expired user #4516]'s profile image [expired user #4516] posted 14 years ago in General Permalink
when exporting routine create sql query seems to be incorrect

generated code is
[localhost] DELIMITER // CREATE DEFINER=`user`@`%` PROCEDURE `timespopulate`(IN `startdate` DATETIME, IN `num` INT) BEGIN DECLARE ctr INT DEFAULT 0; WHILE ctr < num DO BEGIN INSERT INTO dates (`date`) VALUES ( DATE_ADD( startdate, INTERVAL ctr day) ); SET ctr = ctr + 1; END; END WHILE; END// DELIMITER ;

/* [localhost] SQL Error (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 'DELIMITER // CREATE DEFINER=`user`@`%` PROCEDURE `timespopulate`(IN `startdate' at line 1 */
ansgar's profile image ansgar posted 14 years ago Permalink
Seems your target server (where you import the file) doesn't support the DELIMITER command. Which server versions (source + targert)?
[expired user #4516]'s profile image [expired user #4516] posted 14 years ago Permalink
source - 5.0.45
target - 5.0.45
ansgar's profile image ansgar posted 14 years ago Permalink
I see. Very special case here with the DELIMITER. That's only for cases in which HeidiSQL executes queries in another database or server. In other cases, these DELIMITER xyz clauses get parsed. Should get some workaround.
Code modification/commit from ansgar.becker, 14 years ago, revision 2988
Fix injection of database name for direct SQL export to database. Also, do not surround procedure+function creation with DELIMITERs when exporting to database or server. See http://www.heidisql.com/forum.php?t=4803
ansgar's profile image ansgar posted 14 years ago Permalink
Fixed

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