Bluehost.com Web Hosting $6.95

updating all columns

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 ...


Go Back   Usenet Forums > Database Forums > MySQL Database

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 03-07-2007
Robert Huff
 
Posts: n/a
Default updating all columns

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
Reply With Quote
  #2 (permalink)  
Old 03-07-2007
Rik
 
Posts: n/a
Default Re: updating all columns

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
Reply With Quote
  #3 (permalink)  
Old 03-07-2007
Robert Huff
 
Posts: n/a
Default Re: updating all columns

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


Reply With Quote
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On




All times are GMT +1. The time now is 05:37 AM.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.0.0