<html>
<body>
Thanks Mark!<br>
I tried both ways.  <br>
my $csv = Text::CSV->new ( { binary => 1, always_quote => 1, }
)  # should set binary attribute.<br>
                        
or die "Cannot use CSV: ".Text::CSV->error_diag ();<br><br>
And with out alway_quote.  Always quote put quotes around interger
and number fields and Excel displayed them as strings, not numbers so
turned always_quote off. <br><br>
At 08:27 AM 16/10/2012, Mark Jubenville wrote:<br>
<blockquote type=cite class=cite cite="">For future reference you can
force Text::CSV to always quote every field by setting 'always_quote' to
true:<br><br>
<tt>my $csv = Text::CSV->new({ always_quote => 1});</tt><br><br>
or for an already instantiated csv object:<br><br>
<tt>$csv->always_quote(1);</tt><br><br>
Cheers,<br><br>
Mark<br><br>
On 10/15/2012 8:14 PM, Chris Jones wrote:<br>
<blockquote type=cite class=cite cite="">It is all working great. 
Thanks for your help! <br>
I am using DBI ADO and Text::CSV. <br><br>
Text::CSV adds quotes where needed.  I was trying to get the same
output as ms access which quotes all text fields whether they contain
white space or not.  For reading in to excel, the quotes on text
fields are not necessary unless there is a white space, new line, etc. in
the field. <br><br>
It works slick.  Much better than opening each file in Access and
exporting to csv. <br><br>
<br><br>
At 04:49 PM 15/10/2012, Chris Jones wrote: <br>
<blockquote type=cite class=cite cite="">Thank you!  It works well
except I can't get quotes around Text fields. <br><br>
I am using: <br>
my $csv = Text::CSV->new ( { binary => 1 } )  # should set
binary attribute. <br>
                        
or die "Cannot use CSV: ".Text::CSV->error_diag ();
<br><br>
$csv->types ([Text::CSV::IV (), <br>
             
Text::CSV::IV (), <br>
             
Text::CSV::PV (), <br>
             
Text::CSV::PV (), <br>
             
Text::CSV::PV (), <br>
             
Text::CSV::PV (), <br>
             
Text::CSV::IV (), <br>
             
Text::CSV::IV ()]); <br><br>
#output database results <br>
 while (my @row=$sth->fetchrow_array) <br>
  { <br>
        #my $line = join(
",", @row ); <br>
        print "@row\n";
<br>
               
my $status = $csv->combine(@row); <br>
               
my $line   = $csv->string(); <br>
               
print "$line\n" <br><br>
        } <br><br>
The output has quotes around the memo fields but the text fields are not
quoted? <br><br>
At 09:21 AM 15/10/2012, Shlomi Fish wrote: <br>
<blockquote type=cite class=cite cite="">Hi Chris, <br><br>
On Mon, 15 Oct 2012 09:07:39 -0400 <br>
Chris Jones <a href="mailto:cj@enersave.ca"><cj@enersave.ca></a>
wrote: <br><br>
> Thank you. <br>
> <br>
> I have written a perl script using DBI ADO.  The <br>
> select and print statements work.  I am using the <br>
> join statement to separate the fields by ',' but <br>
> I can't figure out a way to get the text fields <br>
> quoted so the output resembles the CSV output by msaccess. <br>
> <br>
> Example output from access: <br>
> 240,10,"SPACE:LGT-W/A[1]","if( Local( ZONE-TYPE )
<br>
> == 1 then 1 endif","Set lighting
power","8.4.4.6","db 2012-04-19 - <br>
> added",1,0 <br>
> <br>
> The field types: <br>
> number, number, text, memo, text, text, memo, integer, integer.
<br>
> <br>
> The output from my script: <br>
> <br>
> 240,10,SPACE:LGT-W/A[1],if( Local( ZONE-TYPE ) == <br>
> 1 then 1 endif,Set lighting power,8.4.4.6,db 2012-04-19 - added,1,0
<br>
> <br>
> Thanks for any insight! <br><br>
Please use
<a href="https://metacpan.org/module/Text::CSV">
https://metacpan.org/module/Text::CSV</a> to output CSV (as well <br>
as read it). Read its documentation for configurations options that
control <br>
the resultant output. <br><br>
Regards, <br><br>
        Shlomi Fish <br><br>
-- <br>
----------------------------------------------------------------- <br>
Shlomi Fish      
<a href="http://www.shlomifish.org/">http://www.shlomifish.org/</a> <br>
My Aphorisms -
<a href="http://www.shlomifish.org/humour.html">
http://www.shlomifish.org/humour.html</a> <br><br>
“My only boss is God. And Chuck Norris who is his boss.” <br><br>
Please reply to list if it's a mailing list post -
<a href="http://shlom.in/reply">http://shlom.in/reply</a> .
</blockquote><br>
>> <br>
Christopher Jones, P.Eng. <br>
Suite 1801, 1 Yonge Street <br>
Toronto, ON M5E1W7 <br>
Tel. 416-203-7465 <br>
Fax. 416-946-1005 <br>
email <a href="mailto:cj@enersave.ca">cj@enersave.ca</a> <br><br>
_______________________________________________ <br>
toronto-pm mailing list <br>
<a href="mailto:toronto-pm@pm.org">toronto-pm@pm.org</a> <br>
<a href="http://mail.pm.org/mailman/listinfo/toronto-pm" eudora="autourl">
http://mail.pm.org/mailman/listinfo/toronto-pm</a> </blockquote><br>
>> <br>
Christopher Jones, P.Eng. <br>
Suite 1801, 1 Yonge Street <br>
Toronto, ON M5E1W7 <br>
Tel. 416-203-7465 <br>
Fax. 416-946-1005 <br>
email <a href="mailto:cj@enersave.ca">cj@enersave.ca</a> <br><br>
_______________________________________________ <br>
toronto-pm mailing list <br>
<a href="mailto:toronto-pm@pm.org">toronto-pm@pm.org</a> <br>
<a href="http://mail.pm.org/mailman/listinfo/toronto-pm" eudora="autourl">
http://mail.pm.org/mailman/listinfo/toronto-pm</a> </blockquote><br>
-- <br><br>
Mark Jubenville
<a href="mailto:ioncache@gmail.com">ioncache@gmail.com</a><br>
_______________________________________________<br>
toronto-pm mailing list<br>
toronto-pm@pm.org<br>
<a href="http://mail.pm.org/mailman/listinfo/toronto-pm" eudora="autourl">
http://mail.pm.org/mailman/listinfo/toronto-pm</a></blockquote>
<x-sigsep><p></x-sigsep>
>><br>
Christopher Jones, P.Eng.<br>
Suite 1801, 1 Yonge Street<br>
Toronto, ON M5E1W7<br>
Tel. 416-203-7465<br>
Fax. 416-946-1005<br>
email cj@enersave.ca<br>
</body>
</html>