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: "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 23 1999 12:12AM

I tried that. That doesnt work either. I also tried,
substring(suser_name(),1,10).
That didnt work either.
Thanks
Dinyar

> -----Original Message-----
> From:	Michael Peppler [SMTP:mpeppler@mbay.net]
> Sent:	Tuesday, February 23, 1999 12:12 AM
> To:	SybPerl Discussion List
> Subject:	RE: error bcp-ing into a column which does not allow nulls
> 
> >>>>> "Tokyo" == Tokyo   writes:
> 
> Tokyo> hi, i just tested it. The bcp went through.  I changed the
> Tokyo> length of the column. made it from 10 to 30 and it worked. I
> Tokyo> was using using suser_name() to get the username. The default
> Tokyo> naming standard here for logins is 8 characters. Which is why I
> Tokyo> had the lenght to 10 chars.  But unfortunately select
> Tokyo> suser_name() returns more than 10 chars. So it looks like I
> Tokyo> will have to modify the column.  Thanks all for all the
> Tokyo> help. We really appreciate it.  Thanks and regards Dinyar
> 
> You could always use select rtrim(suser_name()).
> 
> Michael
> 
> 
> 
> >> -----Original Message----- From: Ghyara, Dinyar (Tokyo)
> >> [SMTP:Dinyar_Ghyara@exchange.japan.ml.com] Sent: Monday, February
> >> 22, 1999 9:42 AM To: SybPerl Discussion List Subject: RE: error
> >> bcp-ing into a column which does not allow nulls
> >> 
> >> Hi, I tried that. No change.  can u think of anything else. I tried
> >> changing all the columns to allow nulls but that gives a diff err,
> >> but the rows got copied in.  can u think of anything else?  thanks
> >> dinyar
> >> 
> >> > -----Original Message----- > From: Bob Buehler
> >> [SMTP:bob.buehler@cpa.state.tx.us] > Sent: Saturday, February 20,
> >> 1999 5:25 AM > To: SybPerl Discussion List > Subject: RE: error
> >> bcp-ing into a column which does not allow nulls > > Perhaps the
> >> length of that first column should be 8 instead of 4.  > > Bob
> >> Buehler > State of Texas > Comptroller of Public Accounts >
> >> (512)463-4361 > > > > -----Original Message----- > > From:
> >> owner-SYBPERL-L@listproc.net > >
> >> [mailto:owner-SYBPERL-L@listproc.net]On Behalf Of Ghyara, Dinyar
> >> (Tokyo) > > Sent: Friday, February 19, 1999 2:08 AM > > To: SybPerl
> >> Discussion List > > Subject: RE: error bcp-ing into a column which
> >> does not allow nulls > > > > > > Hi, > > I forogt to add, we are
> >> using Sybase 11.5.1 ebf 8198 and Open > > Client 11.1.1 > > ebf
> >> 7883 > > And Perl 5.00404, Sybperl 2.09_05.  > > sorry about that.
> >> > > thanks > > dinyar > > > > > -----Original Message----- > > >
> >> From: Ghyara, Dinyar (Tokyo) > >
> >> [SMTP:Dinyar_Ghyara@exchange.japan.ml.com] > > > Sent: Friday,
> >> February 19, 1999 11:39 AM > > > To: SybPerl Discussion List > > >
> >> Subject: RE: error bcp-ing into a column which does not allow nulls
> >> > > > > > > Hi, > > > 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 > > > > > >
> >> Sybase::BCP::dberrhandle("syberrhandle"); > > >
> >> Sybase::BCP::dbmsghandle("sybmsghandle"); > > > > > >
> >> $OUTPUT_FIELD_SEPARATOR=","; > > > # Open data file > > >
> >> open(MLILDAT, "testrate.dat" ) || die "ERROR : Cannot open data
> >> file > > > testrate.dat: $OS_ERR > > > OR\n"; > > > > > > 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 > > > 19990202,1.2,, > > > 19990205,1.5,,
> >> > > > > > > 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.  > > > thanks > > > dinyar > > > > > > > > > > > > > >
> >> > > -----Original Message----- > > > > From: Bob Buehler
> >> [SMTP:bob.buehler@cpa.state.tx.us] > > > > 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:
> >> owner-SYBPERL-L@listproc.net > > > > >
> >> [mailto:owner-SYBPERL-L@listproc.net]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 > > > > > > >
> 
> 
> 
> -- 
> Michael Peppler         -||-  Data Migrations Inc.
> mpeppler@mbay.net       -||-  http://www.mbay.net/~mpeppler
> Int. Sybase User Group  -||-  http://www.isug.com
> Sybase on Linux mailing list: ase-linux-list@isug.com