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



***********************************************************************
      Visit our Internet site at http://www.rbsmarkets.com

This e-mail is intended only for the addressee named above.
As this e-mail may contain confidential or privileged information,
if you are not the named addressee, you are not authorised to
retain, read, copy or disseminate this message or any part of it.
The Royal Bank of Scotland plc is registered in Scotland No 90312
Registered Office: 36 St Andrew Square, Edinburgh EH2 2YB 
Regulated by the Financial Services Authority
***********************************************************************

Reply via email to