On Tue, 07 Aug 2001 21:49:47 -0500, [EMAIL PROTECTED] wrote:

>What is the best way to pull all the data from a table, then put into a text
>file and have it tab delimited for each column value:

Well OK. I assume that your fields don't contain tabs nor newlines, and
that you thus don't need to quote any fields?

>$query = qq|select * from orders|;
>$sth = $dbh->prepare($query);
>$sth->execute();
>
>open(FILE,">$export_file");
>while(my @rows = $sth->fetchrow_array()) {
># THIS IS WHERE I SEEM TO LOOSE IT
>
>print FILE @rows . '\t;
>
>}
>close (FILE)

Yup you lost it. Oh BTW, do you want any headers?

     local ($\, $,) = ("\n", "\t");
     open(FILE,">$export_file");
     print @{$sth->{NAME}};
     while(my @rows = $sth->fetchrow_array) {
          print @rows;
     }

That's it.

-- 
        Bart.

Reply via email to