How can I suppress column header output for a single SQL statement?

I execute some SQL statements in batch mode (using the mysql binary). I want one of my several SELECT statements not to print column headers, but only selected records. Is it possible?

+59
mysql output suppression
Apr 19 '13 at 9:30
source share
3 answers

Call mysql with -N (option -N --skip-column-names ):

 mysql -N ... use testdb; select * from names; +------+-------+ | 1 | pete | | 2 | john | | 3 | mike | +------+-------+ 3 rows in set (0.00 sec) 

Credit ErichBSchulz to indicate the alias -N.

To remove the grid (vertical and horizontal lines) around the results, use -s ( --silent ). Columns are separated by the TAB symbol.

 mysql -s ... use testdb; select * from names; id name 1 pete 2 john 3 mike 

To output data without headers and without a grid, use both -s and -N .

 mysql -sN ... 
+127
Jan 02 '14 at 16:17
source share

You can fake it like this:

 -- with column headings select column1, column2 from some_table; -- without column headings select column1 as '', column2 as '' from some_table; 
+14
Jul 02 '14 at 14:34
source share

You can try using the Data Export Function (TEXT format in command line mode) in dbForge Studio for MySQL.

Create several data export templates in the Data Export Wizard, check the Show table title box, write a bat file to run the tool with the / dataexport switch using the created tempates.

-3
Apr 19 '13 at 14:13
source share



All Articles