Add the -t option to ensure you're getting the table output stuck into your file.

mysql -t -uuser -N -e"select date_format('2004-02-29','%X')" > sample2.txt

Yingyos wrote:
Hi Victor Pendleton ,

I type this command line.

mysql -uuser -N -e"select date_format('2004-02-29','%X')" > sample2.txt
When i open in text editor,it show that '2004' only.

But i want format display on text file.

mysql> select date_format('2004-02-29','%X');
+--------------------------------+
| date_format('2004-02-29','%X') |
+--------------------------------+
| 2004                           |
+--------------------------------+
1 row in set (0.00 sec)

How 's to do?

Thank you for reply again,
Yingyos  Santipasert


Victor Pendleton wrote:


mysql -uuser -N -e"select date_format('2004-02-29','%X')" > sample2.txt
-----Original Message-----
From: Yingyos
To: Victor Pendleton
Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: 5/4/04 11:04 PM
Subject: Re: Export query to text file

Victor Pendleton wrote:



The `INTO OUTFILE` clause is expecting a table reference. An

alternatvie is


mysql -uuser -N -e"select now()" > sample2.txt

-----Original Message-----
From: Yingyos
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Sent: 5/4/04 2:20 AM
Subject: Export query to text file

Hi,

I have MySQL 4.0.17 on Windows XP.
I use SELECT ... INTO OUTFILE print out query to text file.
If i write this command.

mysql>SELECT * from tbl1 INTO OUTFILE "C:\\Query\\sample1.txt";

MySQL reponse OK.But i change command.

mysql>SELECT now() INTO OUTFILE "C:\\Query\\sample2.txt";
MySQL response by exit from console.

How's to use SELECT ... INTO OUTFILE with datetime or another function.


Thank for the reply, Yingyos Santiprasert










Hi Victor Pendleton ,

I want format on text file .

mysql> select date_format('2004-02-29','%X');
+--------------------------------+
| date_format('2004-02-29','%X') |
+--------------------------------+
| 2004                           |
+--------------------------------+
1 row in set (0.00 sec)

How 's to do?

Thank you for reply again,
Yingyos  Santipasert











--
Senior Programmer, Tufts University Sciences Knowledgebase
[EMAIL PROTECTED]
617.636.0959


-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]



Reply via email to