Re: Output to a file
On 5/5/06, Rhino [EMAIL PROTECTED] wrote: - Original Message - From: Payne [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Friday, May 05, 2006 12:09 AM Subject: Output to a file Hey, been trying to output a select statment to a file, all the books I have only show how to input from a file, what is the correct way I thought I could do select * from my_toy `/tmp/my_toys` But I get an error. Here is a snippet from some documentation about MySQL which I wrote for myself. It shows a different technique for capturing output from a batch file into an output file; if the batch file contains 'select * from my_toy', it will capture the output in a file. It's not exactly what you want but maybe it will be close enough. Running a script from OS prompt If you are connected to the database and are at an OS prompt, use this pattern: mysql batch-file output-file For example, if I want to run a script or batch file named my_batch_file.sql and write the output of the script to a file named my_batch_file.out, I'd need to do this: mysql my_batch_file.sql my_batch_file.out If you are NOT connected to the database, use this pattern: mysql -u username -p batch_file output_file For example, if your user name is 'fred' and your password is 'dino' and you want to run a script or batch file named my_batch_file.sql against database 'barf' and write the output to a file called my_batch_file.out, you'll need to do this: mysql barf -u fred -p my_batch_file.sql my_batch_file.out [Be sure to supply the password when prompted.] -- Rhino -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.392 / Virus Database: 268.5.4/332 - Release Date: 04/05/2006 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED] select * into outfile '/tmp/new.txt' from tablename where condition = '1'; looks to me a good option. Best Regards, Abhishek Jain
Re: Output to a file
- Original Message - From: Payne [EMAIL PROTECTED] To: mysql@lists.mysql.com Sent: Friday, May 05, 2006 12:09 AM Subject: Output to a file Hey, been trying to output a select statment to a file, all the books I have only show how to input from a file, what is the correct way I thought I could do select * from my_toy `/tmp/my_toys` But I get an error. Here is a snippet from some documentation about MySQL which I wrote for myself. It shows a different technique for capturing output from a batch file into an output file; if the batch file contains 'select * from my_toy', it will capture the output in a file. It's not exactly what you want but maybe it will be close enough. Running a script from OS prompt If you are connected to the database and are at an OS prompt, use this pattern: mysql batch-file output-file For example, if I want to run a script or batch file named my_batch_file.sql and write the output of the script to a file named my_batch_file.out, I'd need to do this: mysql my_batch_file.sql my_batch_file.out If you are NOT connected to the database, use this pattern: mysql -u username -p batch_file output_file For example, if your user name is 'fred' and your password is 'dino' and you want to run a script or batch file named my_batch_file.sql against database 'barf' and write the output to a file called my_batch_file.out, you'll need to do this: mysql barf -u fred -p my_batch_file.sql my_batch_file.out [Be sure to supply the password when prompted.] -- Rhino -- No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.1.392 / Virus Database: 268.5.4/332 - Release Date: 04/05/2006 -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Output to a file
Hey, been trying to output a select statment to a file, all the books I have only show how to input from a file, what is the correct way I thought I could do select * from my_toy `/tmp/my_toys` But I get an error. Payne -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Output to a file
Payne wrote: Hey, been trying to output a select statment to a file, all the books I have only show how to input from a file, what is the correct way I thought I could do select * from my_toy `/tmp/my_toys` But I get an error. Payne You can use the 'tee' command, eg: tee logfile.txt Or you can start mysql with the --tee switch, eg: mysql --tee logfile.txt -- Daniel Kasak IT Developer NUS Consulting Group Level 5, 77 Pacific Highway North Sydney, NSW, Australia 2060 T: (+61) 2 9922-7676 / F: (+61) 2 9922 7989 email: [EMAIL PROTECTED] website: http://www.nusconsulting.com.au -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Output to a file
Hi Payne. Payne wrote: Hey, been trying to output a select statment to a file, all the books I have only show how to input from a file, what is the correct way I thought I could do select * from my_toy `/tmp/my_toys` You can do 'select * into outfile from table name;' But I get an error. Payne -- Luke Vanderfluit. Analyst/Programmer. Internode Systems Pty. Ltd. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
output in text file /migration
Hi, I want to migrate 1 table from MYSQL to oracle ? how to do that ? How to get output of table into text file? thanks . - Yahoo! Mail Mobile Take Yahoo! Mail with you! Check email on your mobile phone.
Re: output in text file /migration
As for your second question, SELECT INTO OUTFILE (making sure mysql user has write privileges in the directory/file you want to write to). MySQL give the example: SELECT a,b,a+b INTO OUTFILE '/tmp/result.text' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '' LINES TERMINATED BY '\n' FROM test_table; ...as producing a CSV file of lines of field-output 'a', 'b' and 'a+b'. On Monday 16 May 2005 15:15, Seena Blace wrote: Hi, I want to migrate 1 table from MYSQL to oracle ? how to do that ? How to get output of table into text file? thanks . - Yahoo! Mail Mobile Take Yahoo! Mail with you! Check email on your mobile phone. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Redirect output to the file
I want to redirect output of the query to the file in tab delimited format. Can this be done? Thanks -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Redirect output to the file
Jerry Swanson wrote: I want to redirect output of the query to the file in tab delimited format. Can this be done? Thanks Select ... INTO OUTFILE: http://dev.mysql.com/doc/mysql/en/SELECT.html or mysql -e (documentation on the same page) HTH, Wolfram -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
re: Output data to file
On Monday 24 March 2003 06:09, Scott Haneda wrote: I want to send the results of Select name, email from messages To a plain text file, how can I do this? The solution: SELECT name,email FROM messages INTO OUTFILE '/tmp/my-file-name'; Scott HanedaTel: 415.898.2602 -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Egor Egorov / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net ___/ www.mysql.com -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Output data to file
I want to send the results of Select name, email from messages To a plain text file, how can I do this? Once I am in the mysql prompt, I can not issue normal shell commands, thanks - Scott HanedaTel: 415.898.2602 http://www.newgeo.com Fax: 313.557.5052 [EMAIL PROTECTED]Novato, CA U.S.A. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe:http://lists.mysql.com/[EMAIL PROTECTED]
Re: Output data to file
hi... pls try this... mysql \T c:\result.txt mysql select name, email from messages; after command executed... you can use this command to stop print result to file. mysql \t; mysql have a nice try :-) Ivan Paul MySQL, Query - Original Message - From: Scott Haneda [EMAIL PROTECTED] To: MySql [EMAIL PROTECTED] Sent: Monday, March 24, 2003 11:09 AM Subject: Output data to file I want to send the results of Select name, email from messages To a plain text file, how can I do this? Once I am in the mysql prompt, I can not issue normal shell commands, thanks - Scott HanedaTel: 415.898.2602 http://www.newgeo.com Fax: 313.557.5052 [EMAIL PROTECTED]Novato, CA U.S.A. -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: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]
Output to a file?
Hello, I'm new to MySQL. I've been able to query the database via PHP and display it within a html page. I would like to out put the results to a flat file tab delimited instead of onto a new page. Thanks for any help. DBA / Unix Administrator Patrick Fowler Wynit, Inc. 6847 Ellicott Drive East Syracuse, NY 13057 V (315) 437-7617 x2172 F (315) 437-0432 - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
re: Output to a file?
Patrick, Thursday, September 26, 2002, 3:38:24 PM, you wrote: PF I'm new to MySQL. I've been able to query the database via PHP and display PF it within a html page. I would like to out put the results to a flat file PF tab delimited instead of onto a new page. Use SELECT INTO OUTFILE: http://www.mysql.com/doc/en/SELECT.html -- For technical support contracts, goto https://order.mysql.com/?ref=ensita This email is sponsored by Ensita.net http://www.ensita.net/ __ ___ ___ __ / |/ /_ __/ __/ __ \/ /Victoria Reznichenko / /|_/ / // /\ \/ /_/ / /__ [EMAIL PROTECTED] /_/ /_/\_, /___/\___\_\___/ MySQL AB / Ensita.net ___/ www.mysql.com - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
redirect output to a file?
Hi, WIth the way eSKUeL (a PHP app I found on freshmeat) displays query results in a table, and the way that copying and pasting that data into a xls or doc file appears I'm hoping to be able to run queries manually on the mysql prompt and have the output redirected to a file so that I'm able to more easily print the output because I don't want all the information that eSKUeL displays on output either (it doesn't make a new page for results so you can see all the available commands as well and I don't want those visible when results are printed). Is there a way to redirect query output to a file? I didn't see anything in the manual that specified how to do this. By the way, when I copy and paste the data from the html table that eSKUeL displays the results in it appears in excel or word such that each piece of data that was within a cell is put onto a different line so everything is vertical when pasted, instead of having a full line for each record. Obviously that isn't useable. THanks Brandon - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
RE: redirect output to a file?
Yes you can run querys from the mysql prompt and redirct them to a file. Here's how. Make a file and call it query. Inside the file put something like this: use db_mydatabase select * from tbl_mytable where something=somethingelse; Then from the prompt (not in the mysql prompt) use this command: mysql -h somehostname -u username -p query results enter the password for the user then edit the results file which it created and there you go. Matthew Scarrow ComIT Solutions Inc. www.comit.ca Phone: 519-442-0100 Fax: 519-442-0429 -Original Message- From: Brandon McCombs [mailto:[EMAIL PROTECTED]] Sent: Sunday, July 14, 2002 5:53 PM To: [EMAIL PROTECTED] Subject: redirect output to a file? Hi, WIth the way eSKUeL (a PHP app I found on freshmeat) displays query results in a table, and the way that copying and pasting that data into a xls or doc file appears I'm hoping to be able to run queries manually on the mysql prompt and have the output redirected to a file so that I'm able to more easily print the output because I don't want all the information that eSKUeL displays on output either (it doesn't make a new page for results so you can see all the available commands as well and I don't want those visible when results are printed). Is there a way to redirect query output to a file? I didn't see anything in the manual that specified how to do this. By the way, when I copy and paste the data from the html table that eSKUeL displays the results in it appears in excel or word such that each piece of data that was within a cell is put onto a different line so everything is vertical when pasted, instead of having a full line for each record. Obviously that isn't useable. THanks Brandon - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
output to a file
Hey Guys, I know this is more of a PHP question, but since most people here now a lot about PHP I thought I'd ask. I have a script that outputs headlines for reviews and I need to output it to a file for inserting into my page, because I can't use php on this specific page so I want to output it to html. how do I do this? I know you use the fopen, fputs and fclose php commands but dont know how to format it, below is my syntax: div align=left table border=0 cellpadding=0 cellspacing=0 width=95% tr td width=100%p font face=Tahoma, Verdana, Arial, Helvetica size=1img src=/images/menu-reviews.gif width=137 height=20brbr?php $db = mysql_connect( db, **, **); mysql_select_db( net3dual_reviews,$db); $r = mysql_query(SELECT * FROM hwureviews ORDER BY num DESC LIMIT 7); $max = mysql_query(select max(num) from hwureviews,$db); while($a=mysql_fetch_array($r)) { printf (nbsp;nbsp;nbsp;nbsp;a href=\%s\img src=\%s\ border=\0\/abrnbsp;nbsp;- a href=\%s\%s/abrbr,$a[url],$a[picurl],$a[picurl],$a[title]) ; } ? /font/p /td /tr /table /div Thanks! -Alex Big Al Behrens E-mail: [EMAIL PROTECTED] Urgent E-mail: [EMAIL PROTECTED] (Please be brief!) Phone: 651-482-8779 Cell: 651-329-4187 Fax: 651-482-1391 ICQ: 3969599 Owner of the 3D-Unlimited Network: http://www.3d-unlimited.com Send News: [EMAIL PROTECTED] - Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail [EMAIL PROTECTED] To unsubscribe, e-mail [EMAIL PROTECTED] Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php