IT Community - Software Programming, Web Development and Technical Support

Writing MYSQL Query Recordset into external file.

This is a discussion on Writing MYSQL Query Recordset into external file. within the Database Support forums, part of the Web Development category; Hi, Here i a simple way of writing MYSQL query record set into text file and csv files. Try this, ...


Go Back   IT Community - Software Programming, Web Development and Technical Support > Web Development > Database Support

Register FAQ Members List Calendar Mark Forums Read
  #1 (permalink)  
Old 07-19-2007, 07:18 AM
Murali Murali is offline
D-Web Master
 
Join Date: Feb 2007
Location: India-Chennai.
Posts: 386
Murali is on a distinguished road
Send a message via AIM to Murali
Thumbs up Writing MYSQL Query Recordset into external file.

Hi,

Here i a simple way of writing MYSQL query record set into text file and csv files.

Try this,

mysql>use test;
Database changed

mysql> SELECT emp_id,emp_name INTO OUTFILE '/usr/local/test/employee.txt' FIELDS TERMINATED BY '|' FROM emp;
Query OK, 101 rows affected (0.00 sec)

mysql> SELECT emp_id,emp_name INTO OUTFILE '/usr/local/test/employee.csv' FIELDS TERMINATED BY ',' ENCLOSED BY '"' LINES TERMINATED BY '\n' FROM emp;
Query OK, 101 rows affected (0.00 sec)

Now go to the specified path and check out for the text / csv files.
The employee Id and the employee name has been written to the externale files.
__________________
-Murali..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-19-2007, 07:52 AM
prasath prasath is offline
D-Web Sr.Programmer
 
Join Date: Jul 2007
Location: Chennai
Posts: 173
prasath is on a distinguished road
Smile Re: Writing MYSQL Query Recordset into external file.

Hi,
i have checked which those queries posted by u,it is executed very fine,but records not move into specified outfile.

Can u clarify?

Thanks,
Prasath.K
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 07-19-2007, 08:03 AM
Murali Murali is offline
D-Web Master
 
Join Date: Feb 2007
Location: India-Chennai.
Posts: 386
Murali is on a distinguished road
Send a message via AIM to Murali
Default Re: Writing MYSQL Query Recordset into external file.

There is no files stored in the specified path?

May be u dont have permission to view the folder, check it with the folder which u have full rights.
__________________
-Murali..
Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Reading and Writing to File using UTL_FILE in ORACLE Murali Database Support 2 08-23-2007 11:12 PM
MySQL Query Performance Tips Murali Database Support 10 08-22-2007 04:10 AM
How do you kill a MySQL query? Sabari Database Support 2 07-17-2007 10:50 PM
How do you open a file for writing? vadivelanvaidyanathan Perl 1 07-17-2007 03:25 AM
MySQL - Query Sniffer shiva Database Support 4 03-21-2007 05:58 AM


All times are GMT -7. The time now is 09:26 PM.


Copyright ©2004 - 2007, DiscussWeb. All Rights Reserved.

SEO by vBSEO 3.0.0