Michael, Great idea, I can get it to work on SuSE Linux (SLES8 for AMD64) just fine: mysql> SYSTEM echo "Some comments" ; Some comments
But on Windows XP (where my user is running that needs this function): mysql> SYSTEM echo Some comments ; -------------- SYSTEM echo Some comments -------------- ERROR 1064: You have an error in your SQL syntax. Check the manual that corresp onds to your MySQL server version for the right syntax to use near 'SYSTEM echo Some comments' at line 1 mysql> SYSTEM "echo Some comments "; -------------- SYSTEM "echo Some comments " -------------- ERROR 1064: You have an error in your SQL syntax. Check the manual that corresp onds to your MySQL server version for the right syntax to use near 'SYSTEM "echo Some comments "' at line 1 mysql> Is the SYSTEM command not supported on Windows? I have been unable to find it documented in the MySQl manual for 4.0.18. Thanks for your help - Richard Michael Stassen wrote: > One more thought: Your mention of echo jogged my memory. You can use > SYSTEM to pass what follows to the system and display the result. So, > > SYSTEM echo "## The following output should only contain two > rows."; > > results in > > ## The following output should only contain two rows. > > assuming echo is a command which makes sense to your system. > > Michael > > > Michael Stassen wrote: > >> >> >> Richard Mixon (qwest) wrote: >> >>> Harald Fuchs wrote: >>> >>>> In article <[EMAIL PROTECTED]>, >>>> Michael Stassen <[EMAIL PROTECTED]> writes: >>>> >>>> >>>>> Richard Mixon (qwest) wrote: >>>> >>>> >>>>>> I run some mysql command files (just SQL statements in a file I >>>>>> read from standard input) and need to place some >>>>>> annotiations/comments in the output. If I place standard SQL >>>>>> comments ("-- comment text") or MySQL comments ("# comment >>>>>> text") they do not show up in the mysql client output. Well, in >>>>>> a way that makes sense - they are "comments". I have tried using >>>>>> "select ' comment text' ;" and that works, but I get many, many >>>>>> lines instead of my one simple annotation - e.g.: >>>>>> -------------- select "First comment ..." >>>>>> -------------- >>>>>> +-------------------+ >>>>>> >>>>>>> First comment ... | >>>>>> >>>>>> >>>>>> +-------------------+ >>>>>> >>>>>>> First comment ... | >>>>>> >>>>>> >>>>>> +-------------------+ >>>>>> 1 row in set (0.00 sec) >>>>>> Any/all ideas are appreciated - Richard >>>>>> >>>> >>>>> SELECT "First comment ..."; >>>> >>>> >>>>> will give exactly the output you show, but >>>> >>>> >>>>> SELECT "First comment ..." FROM sometable; >>>> >>>> >>>>> will return that string once for each row of the table. Is that >>>>> what you're doing? >>>> >>>> >>>> I guess he's talking about the column headers produced by the >>>> "mysql" client program. These can be suppressed by using "mysql >>>> -N". >>> >>> >>> >>> Michael/Harald, >>> >>> Thanks for the tip. But: >>> >>> 1) Yes, I am just issuing: SELECT "First comment ..."; >>> and >>> 2) The problem is that instead of getting a single line of text >>> (i.e. my "annotation/comment"), I get many, for example the command >>> "select "COMMENT 3";" produces the following (even using the -N >>> flag when I startup mySQL): -------------- >>> SELECT "COMMENT 3" >>> -------------- >>> >>> +-----------+ >>> | COMMENT 3 | >>> +-----------+ >>> 1 row in set (0.00 sec) >>> The problem with "-N" is that is suppresses all of the headers. >>> What I really need is an "echo" or "print" command. >>> >>> The idea is to guide the reader of the mysql client output with some >>> comments. The SQL might look like the following: >>> SELECT "The following output should only contain two rows for >>> status ..."; SELECT status,count(*) FROM PoClass GROUP BY status; >>> SELECT "The following output should only contain three rows for >>> status ..."; SELECT status,count(*) FROM PoClassMeasurement GROUP >>> BY status; >>> >>> Thank you - Richard >> >> >> Well, it's not exactly what you want, but you could use an alias to >> give each comment a standard header: >> >> SELECT 'The following output should only contain two rows for >> status.' AS COMMENT; >> >> +---------------------------------------------------------------+ >>> COMMENT | >> +---------------------------------------------------------------+ >>> The following output should only contain two rows for status. | >> +---------------------------------------------------------------+ 1 >> row in set (0.00 sec) >> >> You still get some extra lines, but perhaps that looks a little >> better. You could also change the alias according to the type of >> comment: >> >> SELECT 'The following output *must* contain only two rows!' AS >> `WARNING!`; >> >> +----------------------------------------------------+ >>> WARNING! | >> +----------------------------------------------------+ >>> The following output *must* contain only two rows! | >> +----------------------------------------------------+ 1 row in set >> (0.00 sec) >> >> Michael >> >> > > http://lists.mysql.com/[EMAIL PROTECTED] -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]