PEPPLER.ORG
Michael Peppler
Sybase Consulting
Menu
Home
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
Freeware
Sybperl
Sybase::Simple
DBD::Sybase
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
FAQs
Sybase on Linux FAQ
Sybperl FAQ
Personal
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: Michael Peppler <mpeppler at peppler dot org>
Subject: RE: Sybase::BCP
Date: Jun 13 2001 8:32PM

Neill, Gregory writes:
 > I've successfully used this: 
 > 
 > use Sybase::DBlib;
 > ...
 > sub bcpOut {
 > 
 >   my $marker = $_[0];
 >   my $dataFile = $_[1];
 >   my $dbHandle = openDB ($key->user_id, $key->password, $key->server);
 >   my $table = "";
 > 
 >   $dbHandle->bcp_init ("$table", "$dataFile", "$errFile", DB_OUT);
 >   my $status = $dbHandle->bcp_exec;
 > 
 >   execSQL ($dbHandle, "truncate table $table\n");
 > 
 >   return $status;
 > 
 > }

Yes, that will work.

But there isn't any real advantage over using the bcp binary to
perform the operation.

Michael


 > > -----Original Message-----
 > > From: Michael Peppler [mailto:mpeppler@peppler.org]
 > > Sent: Wednesday, June 13, 2001 1:17 PM
 > > To: SybPerl Discussion List
 > > Subject: Re: Sybase::BCP
 > > 
 > > 
 > > Kilzer, Greg writes:
 > >  > Hello,
 > >  > 
 > >  > I'd like to use the BCP out routine in Sybperl. The 
 > > documentation that I
 > >  > have
 > >  > read says that BCP out is not yet implemented. Is this 
 > > still current? Has 
 > >  > it been implemented yet?
 > > 
 > > No, and it's unlikely that it will be.
 > > 
 > > BCP out is really just a select, with the data formatted in a specific
 > > way.
 > > 
 > > You can achieve the same results with something like this:
 > > 
 > > $" = "\t";
 > > $dbh->ct_sql("select * from the_table", 0, sub { print "@_\n"; });
 > > 
 > > (although this prints to stdout, instead of a file, but you get the
 > > idea...) 
 > > 
 > > Michael
 > > -- 
 > > Michael Peppler - Data Migrations Inc. - mpeppler@peppler.org
 > > http://www.mbay.net/~mpeppler - mpeppler@mbay.net
 > > International Sybase User Group - http://www.isug.com
 > > Sybase on Linux mailing list: ase-linux-list@isug.com
 > > 
 > 

-- 
Michael Peppler - Data Migrations Inc. - mpeppler@peppler.org
http://www.mbay.net/~mpeppler - mpeppler@mbay.net
International Sybase User Group - http://www.isug.com
Sybase on Linux mailing list: ase-linux-list@isug.com