Michael Peppler
Sybase Consulting
Sybase on Linux
Install Guide for Sybase on Linux
General Sybase Resources
General Perl Resources
BCP Tool
Bug Tracker
Mailing List Archive
Downloads Directory
Sybase on Linux FAQ
Sybperl FAQ
Michael Peppler's resume

sybperl-l Archive

Up    Prev    Next    

From: "Ghyara, Dinyar (Tokyo)" <Dinyar_Ghyara at exchange dot japan dot ml dot com>
Subject: RE: error bcp-ing into a column which does not allow nulls
Date: Feb 19 1999 2:39AM

You were right. I hadnt bound the defaults to the columns.
I just bound defaults to the columns. 

Now I get a different error.
Sybase Error Handler: 
Severity 1, dberr 20074, oserr -1 
insert bulk testdb..testrate
dberr: Attempt to bulk-copy an oversized row to the SQL Server.

this is what the table looks like

 Column_name     Type            Length Prec Scale Nulls Default_name
Rule_name       Identity 
 --------------- --------------- ------ ---- ----- ----- ---------------
--------------- -------- 
 cobdate         GENDATETIME          4 NULL  NULL     0 NULL
NULL                   0 
 rate            GENRATE              8 NULL  NULL     0 ZERO
NULL                   0 
 asofdate        ASOFDATE             8 NULL  NULL     0 CURDATE
NULL                   0 
 userid          USERID              10 NULL  NULL     0 CURUSER
NULL                   0 

these are the defaults

create default ZERO as 0
create default CURUSER as suser_name()
create default CURDATE as getdate()

this is the code snippet that does the bcp bit

# Open data file
open(MLILDAT, "testrate.dat" ) || die "ERROR : Cannot open data file
testrate.dat: $OS_ERR

print STDERR "Parsing data-file & Bulk-copying .....\n";
$bcp = new  Sybase::BCP "sa", "password", "TESTSERVER";
$bcp->config(INPUT => \&getNextRow,
                        OUTPUT => "testdb..testrate",
                        DIRECTION => "IN",
                        SEPARATOR => $OUTPUT_FIELD_SEPARATOR,
                        BATCH_SIZE => 1000,
                        ERRORS => "/tmp/bcp.din",
                        FIELDS => 4);

and this is the file that I am bcp-ing in

sorry for piling on like this. but i think we are missing something
but cant see it. so we hope u guys could help us out.

> -----Original Message-----
> From:	Bob Buehler []
> Sent:	Friday, February 19, 1999 6:31 AM
> To:	SybPerl Discussion List
> Subject:	RE: error bcp-ing into a column which does not allow nulls
> You can look at the table definition using sp_help tablex (where tablex is
> the table name). This will show you the columns defined with "not null" (0
> if nulls are NOT permitted, 1 if nulls are allowed). Apparently, it is
> complaining about data for the first column of your table. sp_help will
> show
> you the column name. Then, take a look at your bcp "in" data source to see
> where you have a null value as the first field.
> Hope this helps.
> Bob Buehler
> State of Texas
> Comptroller of Public Accounts
> (512)463-4361
> > -----Original Message-----
> > From:
> > []On Behalf Of Ghyara, Dinyar (Tokyo)
> > Sent: Wednesday, February 17, 1999 7:21 PM
> > To: SybPerl Discussion List
> > Subject: error bcp-ing into a column which does not allow nulls
> >
> >
> > hi all,
> > i was going through the arcives of this sybperl list and i saw that one
> of
> > the members
> > had a problem while using th bcp module. they were getting the error :
> > Sybase error: Attempt to bulk-copy a NULL value into Server
> > column 1, which
> > does not accept NULL values.
> > any ideas on how this was resolved. We are getting the same error here.
> > thanks
> > dinyar
> >