views:

144

answers:

1

Is there any way to update all the records in a table if there is atleast one filed which has empty value?

Thanks.

+1  A: 

Not without using all the fields in the query. If this is your table:

col0: TEXT NULL,
col1: TEXT NULL,
col2: INT NULL

you can issue:

UPDATE YourTable SET col0='yourValue' WHERE col1 IS NULL or col2 IS NULL
soulmerge
Is there are lot of cols , is there any way to avoid mentioning all the ones?
JPro
no, there isn't, you'll need to provide them manually. But you have the option of fetching existing column names from the according schema table: http://dev.mysql.com/doc/refman/5.0/en/columns-table.html
soulmerge