Why would somefield be null?  Shurely somefield is the unique key for
your table, and as such you wouldn't have inserted a null into it?  I
think if somefield is null, there's some other problem going on.

There is one situation where this sort of problem would arise.  If you
insert a record into your dataset, and somefield is an auto-incrementing
column which you set to null and which is filled in by the database,
then you need to somehow retrieve that value from the database into your
dataset before you can do any updates - otherwise you'll be updating the
wrong record (your record will now have a value for somefield, but
you'll be updating where somefield = null, which won't do anything).
How you achieve this depends very much on what your specific situation
is and whether you're using cached updates or a ClientDataSet.  If this
sounds like the problem, provide some more details and I can probably
help out...

Cheers,

Carl Reynolds                      Ph: +64-9-4154790
CJN Technologies Ltd.             Fax: +64-9-4154791
[EMAIL PROTECTED]                DDI: +64-9-4154795
PO Box 302-278, North Harbour, Auckland, New Zealand
12 Piermark Drive, North Harbour Estate, Auckland, NZ
Visit our website at http://www.cjntech.co.nz/

> -----Original Message-----
> From: Mark Derricutt [SMTP:[EMAIL PROTECTED]]
> Sent: Wednesday, October 20, 1999 11:40 AM
> To:   Multiple recipients of list database
> Subject:      [DUG-DB]:  update sql's and null where clause entries...
> 
> I have a slight problem, I have an update query which works 99% of the
> time, unless the existing field is null.
> 
> In my where clause I do "where somefield = :old_somefield" (using an
> UpdateSQL object, which fails when somefield is null before editing.
> Is
> where anyway around this?
> 
> -- 
> Mark Derricutt, He that brings forth electronic life.
> Now Playing: Tori Amos - To Venus And Back
> 
> ----------------------------------------------------------------------
> -----
>   New Zealand Delphi Users group - Database List -
> [EMAIL PROTECTED]
>                   Website: http://www.delphi.org.nz

application/ms-tnef

Reply via email to