Ugh, I just wasted time debugging a MySQL script only to find that I had created a syntactically invalid comment. So, as a future reminder to myself (and to warn others), MySQL supports 3 different comment styles: # marks the start of a comment (until the end of the line) -- also marks the start of a comment (until the end of a line) /* */ can be used to mark the start and end of comments (supporting multi-line comment, too). # ## and even ######### are all valid comment designators. But you need to be careful with -- (double hyphen) because -- is only a comment designator if it is followed by a space. Use more than 2 hyphens, or omit the space between the hyphens and the comment text, and all of the text will be part of your SQL.
Watch Those MySQL Comments
·
2 Comments
Leave a Comment