ID #1049

I get error 1064 when executing (multiple) query(ies).

 

This is not really a bug with MySQL but nevertheless an undocumented issue that causes a problem with execution of queries with comments.

A series of queries with a comment like

sqlstatement_1;
sqlstatement_2;
...
sqlstatement_n;
// this is a comment

raise the infamous MySQL error: "Error Code: 1064: You have an error ..." when you "execute all queries" from the SQLyog query-pane. However those three

sqlstatement_1;
sqlstatement_2;
...
sqlstatement_n;
# this is a comment

and

sqlstatement_1;
sqlstatement_2;
...
sqlstatement_n;
/* this is a comment */

and

sqlstatement_1;
sqlstatement_2;
...
sqlstatement_n;
-- this is a comment

don't raise any error.

The MySQL documentation at http://dev.mysql.com/doc/refman/5.0/en/comments.html clearly states that only the three last styles/formats are valid comments with the MySQL server. Sometimes the //style comment works too and some people use it frequently. When it works it is because support for it is implemented in the client used and this //comment is 'stripped out' before the queries are sent to the server.

We do not support the //style comments in SQLyog. Use one of the three styles/formats available with the MySQL server.

Also with the Import External Data Tool we have had examples of queries failing (when connecting to Oracle for instance) when queries contained such //comments. They did work with the client that the user used to use (and this user never thought about it was implemented with the client for Oracle only) but they do not work with the SJA either. Use a comment-syntax supported by the source server!

 

Categories for this entry

Tags: -

Related entries:

You can comment this FAQ