On Thu, 05 Feb 2004 21:28:50 GMT, kurt.wood@NOSP@M.state.mn.us (Remove
the obvious for replies) wrote:
[color=blue][color=green]
>>There is a big difference between NULL and an empty string. ADO is an
>>ActiveX layer around ODBC, AFAIK. NULLs have been around since
>>prehistoric (DBMS) times. You need to distinguish between the two.
>>[/color]
>I have a firm grip on what null is and what an empty string is.[/color]
OK. I apologize if I sounded condescending ... I didn't mean to, just
trying to establish a common point of agreement. You might be
surprised to see how many people don't know the difference, especially
when coming from Access or VB.
[color=blue]
>In this , we have a "nullable" field with a list of 4 possible values. If
>on the VB form, we delete the value in the control, then behind the
>scenes we trap for an empty string, convert that to a null and try to
>pass that to the database. This works fine on a 7.2 client, but with
>an 8.1.4 client, our null is "reconverted" to an empty string.[/color]
[color=blue][color=green]
>>How are you defining a "NULL" value on the client side? If the[/color]
>We define null by setting it to VBNullString (also VBNull and
>VBNullChar)[/color]
[color=blue][color=green]
>>Is it a matter of bind variables? Or are you constructing the SQL
>>completely as text?[/color]
>ODBC hanldes the low level operations for the ADO calls.[/color]
Hmmm ... since nothing has changed on the VB/ADO side, I suppose that
it was passing an empty string all along. Only the DB2 client has
changed.
I wonder if there is a setting in the DB2 client or server which would
influence how the database handles empty strings? I believe that with
Oracle, for example, there is a parameter for this. I know because we
had a procedure with a little lookup table and querying for NULL
worked in our test environment, but failed in production because it
was either returning a single space or an empty string.
What about doing the updates through a stored procedure? Or a
BeforeUpdate/BeforeInsert trigger?
[color=blue][color=green][color=darkred]
>>>I have opend a PMR with IBM, but they are saying the only reason that
>>>these problems didn't show up in previous versions is because there
>>>was an error in those versions that accidently allows those values to
>>>pass and that the version 8 client is working as expected.[/color]
>>
>>They are probably right.[/color]
> Maybe, but that would sure show poor QA/QC in allowing an error to
>propagate thru 3 complete versions of DB2....[/color]
If it were a known issue, I would agree with that. Maybe it just never
seemed to matter?
[color=blue][color=green][color=darkred]
>>>Has anyone else seen this and is there some kind of a work-around ??[/color]
>>
>>The work-around is not to try to pass a null value to a column which
>>has a "not null" constraint. Is there a default value defined? If so,
>>just leave that column out of any INSERT statements.[/color]
>ahhh, yup...[/color]
OK, you did say the column is nullable ... I would (a) look for a
possible setting on the DB2 side of things, and (b) look into doing
the updates through a stored procedure.
--
Bob Hairgrove
NoSpamPlease@Home.com