Archives: March 2012

Preserve Comments in MySQL Stored Procedures

Comments in any code are good practice and can help guide yourself and others through more complicated processes.

Single and multi-line comments can be included in MySQL stored procedures using the following syntax:

# a single-line comment

select 1;

/* a
   multi-line
   comment
*/

When creating stored procedures for a MySQL database using a GUI, like MySQL Browser, any comments added are preserved (as you would expect). However, if you use the command line client you may have noticed that comments are stripped out. The command line client removes any comments before executing the script so comments are lost. Read More »

Posted in Programming | Tagged | 2 Comments