This is a discussion on updating all columns within the MySQL Database forums, part of the Database Forums category; I have a 5.1 database where one table has many columns. Is there a way to update all the ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
I have a 5.1 database where one table has many columns.
Is there a way to update all the columns in a row without specifying every column identifier? I've looked at "UPDATE" and "INSERT ... ON DUPLICATE KEY UPDATE", but neither seem to be quite what I'm looking for. Robert Huff |
|
|||
|
Robert Huff <roberthuff@rcn.com> wrote:
> I have a 5.1 database where one table has many columns. > Is there a way to update all the columns in a row without specifying > every column identifier? I've looked at "UPDATE" and "INSERT ... ON > DUPLICATE KEY UPDATE", but neither seem to be quite what I'm looking for. Nasty, nasty: REPLACE INTO... If you're using a primary ID, this will actually delete the row with that ID, and insert a new one with that ID. Any constraints may be checked and/or cascaded AFAIK. I'm actually very against this kind of 'update'. Also, specifying column names is a good thing. It will save you loads of debugging when for instance it's decided there should be a field more or less in a table. -- Rik Wasmus Posted on Usenet, not any forum you might see this in. Ask Smart Questions: http://tinyurl.com/anel |
|
|||
|
Rik wrote:
> Also, specifying column names is a good > thing. It will save you loads of debugging when for instance it's > decided there should be a field more or less in a table. Fully aware of that. However: a) this is a one-shot circumstance where it's not an unreasonable technical choice, and b) it's not entirely my call. Robert Huff |