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

后端 未结 8 1826
情歌与酒
情歌与酒 2020-12-29 03:20

I\'m trying to figure out a way to update a record without having to list every column name that needs to be updated.

For instance, it would be nice if I could use so

8条回答
  •  野趣味
    野趣味 (楼主)
    2020-12-29 03:45

    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}] ...
    [WHERE ...]
    

提交回复
热议问题