Subject Re: [firebird-support] Partial update
Author setysvar
Den 13.02.2017 20:40, skrev Dimitry Sibiryakov sd@...
[firebird-support]:
> Hello, All.
>
> If I use prepared statement like this "update table set field1=?, field2=? where
> field3=?" for performance reasons, is there a way to update only some fields and leave
> other untouched without overhead of building separate queries on the fly or selecting old
> values with different query?

I'm more of a SELECT than UPDATE guy (and haven't tried my suggestion),
but wouldn't

update table set field1=coalesce(?, field1), field2=coalesce(?, field2) where
field3=?

get the right result (well, unless you could have instructions like "Set
field2 to <null>;")? Theoretically, I would of course expect such a
statement to "change" the value to the existing value rather than
leaving it untouched when the parameter is <null>.

HTH,

Set