If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > Perl and the DBI > in perl dbi How To Generate CSV for 1 lakh record of my Query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 05-11-11, 06:16
dashang.trivedi dashang.trivedi is offline
Registered User
 
Join Date: May 2011
Posts: 5
in perl dbi How To Generate CSV for 1 lakh record of my Query

Hello EveryOne,

My Objective is to generate CSV file of my query output.
if my table have 1 Lakh record...
i am using this way
Code:
open(CSV, "> file.csv"); 
$sth = $dbh->prepare('SELECT * FROM exmpl_tbl '); 
$sth->execute(); 
while($result = $sth->fetchrow_hashref()) { 
  print CSV  "$result->{id} , $result->{val} \n"; 
} 
 
close(CSV);
This way is not optimize way to generate CSV...
how to generate CSV for 1 lakh record or more in fast way....

so please suggest me .....
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

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