Keeping existing field value if no parameter is specified for that field
Posted: Mon 09 Dec 2013 18:03
I have a query with an SQLUpdate text with some parameters such as:
UPDATE SomeQuery
SET
Field1 = :Param1 , Field2 = :Param2 , Field3 = :Param3
WHERE
ID = :Old_ID
Is there a way to keep the existing field value if no param is specified for that field?
In other words, if I wrote:
Query.ParamByName('Param1').AsInteger := 0;
Query.ParamByName('Param2').AsInteger := 0;
{ Note that Param3 is not specified in the update query though it's defined in the SQLupdate text}
Query.ParamByName('Old_ID').AsInteger := AId;
Query.Execute;
I would like that Field3 could keep its current value without the need to specify it by code.
Thanks.
UPDATE SomeQuery
SET
Field1 = :Param1 , Field2 = :Param2 , Field3 = :Param3
WHERE
ID = :Old_ID
Is there a way to keep the existing field value if no param is specified for that field?
In other words, if I wrote:
Query.ParamByName('Param1').AsInteger := 0;
Query.ParamByName('Param2').AsInteger := 0;
{ Note that Param3 is not specified in the update query though it's defined in the SQLupdate text}
Query.ParamByName('Old_ID').AsInteger := AId;
Query.Execute;
I would like that Field3 could keep its current value without the need to specify it by code.
Thanks.