How to UPDATE all columns of a record without having to list every column

It’s not possible. What you’re trying to do is not part of SQL specification and is not supported by any database vendor. See the specifications of SQL UPDATE statements for MySQL, Postgresql, MSSQL, Oracle, Firebird, Teradata. Every one of those supports only below syntax: UPDATE table_reference SET column1 = {expression} [, column2 = {expression}] … … Read more

SQL Update Multiple Fields FROM via a SELECT Statement

Something like this should work (can’t test it right now – from memory): UPDATE SHIPMENT SET OrgAddress1 = BD.OrgAddress1, OrgAddress2 = BD.OrgAddress2, OrgCity = BD.OrgCity, OrgState = BD.OrgState, OrgZip = BD.OrgZip, DestAddress1 = BD.DestAddress1, DestAddress2 = BD.DestAddress2, DestCity = BD.DestCity, DestState = BD.DestState, DestZip = BD.DestZip FROM BookingDetails BD WHERE SHIPMENT.MyID2 = @MyID2 AND BD.MyID … Read more

SQL UPDATE order of evaluation

MySQL does “left to right” evaluation and does “see” the new values. (Tested on 5.0.45-community-nt-log MySQL Community Edition) Furthermore, from the MySQL manual: “Single-table UPDATE assignments are generally evaluated from left to right. For multiple-table updates, there is no guarantee that assignments are carried out in any particular order.” Now, “generally” is quite vague and … Read more

Within a trigger function, how to get which fields are being updated

If a “source” doesn’t “send an identifier”, the column will be unchanged. Then you cannot detect whether the current UPDATE was done by the same source as the last one or by a source that did not change the column at all. In other words: this does not work properly. If the “source” is identifiable … Read more