|
On Wed, 2005-03-09 at 17:59, JLong@xxxxxxxxxx wrote: > I am wanting to update a record using SQL. I already have the record > locked and have "Set" the necessary fields to a new value. I wish to > update the changed fields but I do not want to build the update to > list the set of fields only to later need to update another set of > fields. //snip > Is there a way to do this with SQL or do I have to create an update > statement for all field combinations that may be updated. > > Thanks > Jack Long > CBK Ltd. > > ______________________________________________________________________ Jack, You can build the update string on the fly and use EXECUTE IMMEDIATELY. You'll have to rebuild the string before every update, so I'm not sure about performance. You can also follow the model from RPGBeans: when you fetch, fetch into an externally defined datastructure that is based on the same file. Then set the values of what ever fields you wish and issue an UPDATE sql command that sets all the fields. This means you only need a single UPDATE routine but you can change differenct fields without recreating the UPDATE command. HTH, Joel
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.