Added Kevin Ansett's initial message to show what is the problem. Yan
> -----Original Message-----
> From: Dong, Yan (Exchange)
> Sent: Tuesday, May 27, 2003 6:04 PM
> To: '[EMAIL PROTECTED]'; '[EMAIL PROTECTED]'
> Cc: '[EMAIL PROTECTED]'
> Subject: Re: BCP & Sybase 12.5
>
> Hi Michael and Kevin,
>
> I know Kevin's question was quite old. But I just had the same problem
> recently when I used the same routine, bcp_init("tableName", ' ', ' ',
> DB_IN).
> I agree with Kevin that the default value specifications may cause the
> problem. I tested using some table without default value specification and
>
> it succeeded.
>
> Do you already have a solution to fix this problem?
>
> Thanks,
>
> Yan
>
>
> Initial message from Michael:
>
> On Thu, 2002-10-24 at 07:52, ANSETT, Kevin, FM wrote:
> > All,
> >
> > Appreciate any help.
> >
> > I am currently trying to bcp some data into a Sybase 12.5 database.
> >
> > Now code works on an 11.9 DB, but not on 12.5.
> >
> > Heres a snippet of the bcp function.
>
> This should probably be taken to the sybperl-l mailing list, as it
> doesn't have anything to do with DBI or DBD::Sybase.
>
> However - could you send me (not the list) a sample of rows that you are
> trying to load?
>
> Thanks,
>
> Michael
> --
> Michael Peppler / [EMAIL PROTECTED] / <http://www.mbay.net/~mpeppler>
> [EMAIL PROTECTED] / ZetaTools, Inc / <http://www.zetatools.com>
> ZetaTools: Call perl functions as Sybase stored procedures!
>
>
> Initial message from Kevin:
>
> All,
>
> Appreciate any help.
>
> I am currently trying to bcp some data into a Sybase 12.5 database.
>
> Now code works on an 11.9 DB, but not on 12.5.
>
> Heres a snippet of the bcp function.
>
>
> $sql = "";
> open (FH, "< $statfile") || die "Couldn't open $statfile: $!";
>
> my @lines = <FH>;
> close FH || die "Couldn't close $statfile\n";
>
> BCP_SETL(TRUE);
>
> my $bcp_dbh = Sybase::DBlib->dblogin("appdbo", "$ENV{RISK_PASSWORD}",
> "$ENV{SQL_SERVER}") ||
> die "Failed to connect to Sybase::DBlib database";
>
> die "Could not use tempdb" if ($bcp_dbh->dbuse("tempdb") == FAIL);
>
> if ($bcp_dbh->bcp_init("static..$stat_table",'','',DB_IN) == FAIL) {
> die "Failed to initialise BCP";
> }
>
> die "Failed to initialise BCP number of columns" if
> ($bcp_dbh->bcp_meminit($num_fields) == FAIL);
>
>
> Code is failing in the bcp_init section with the following error:-
>
> DB-Library error:
> bcp protocol error: default value datatype differs from column
> datatype.
>
>
> Table being loaded into looks as following:-
>
> CREATE TABLE dbo.ctrpty_rating
> (
> party_id int NOT NULL,
> sap_short char(10) DEFAULT ' ' NOT NULL,
> sap_long char(10) DEFAULT ' ' NOT NULL,
> sap_outlook char(10) DEFAULT ' ' NOT NULL,
> sap_grader char(20) DEFAULT ' ' NOT NULL,
> sap_date datetime DEFAULT '01-jan-9999' NOT NULL,
> ibca_short char(10) DEFAULT ' ' NOT NULL,
> ibca_long char(10) DEFAULT ' ' NOT NULL,
> ibca_look char(10) DEFAULT ' ' NOT NULL,
> ibca_support char(10) DEFAULT ' ' NOT NULL,
> ibca_other char(10) DEFAULT ' ' NOT NULL,
> ibca_grader char(20) DEFAULT ' ' NOT NULL,
> ibca_date datetime DEFAULT '01-jan-9999' NOT NULL,
> best_long char(10) DEFAULT ' ' NOT NULL,
> best_other char(10) DEFAULT ' ' NOT NULL,
> best_grader char(20) DEFAULT ' ' NOT NULL,
> best_date datetime DEFAULT '01-jan-9999' NOT NULL,
> intl_rating char(10) DEFAULT ' ' NOT NULL,
> group_template char(30) DEFAULT ' ' NOT NULL,
> intl_approver char(10) DEFAULT ' ' NOT NULL,
> intl_approver_name varchar(60) DEFAULT ' ' NOT NULL,
> intl_proposer char(10) DEFAULT ' ' NOT NULL,
> intl_proposer_name varchar(60) DEFAULT ' ' NOT NULL
> )
> LOCK ALLPAGES
> WITH EXP_ROW_SIZE=1
> go
>
> Any suggestions appreciated..............
>
> Code appears to fall over due to the defaults????
>
> Anyway, help pls???
>
> Regs,
>
> Kevin Ansett
****************************************************************
Bear Stearns is not responsible for any recommendation, solicitation,
offer or agreement or any information about any transaction, customer
account or account activity contained in this communication.
***********************************************************************