5

Still learning SQL-Fu, and trying to figure out how to do a simple update on my Table (ex. [TABLE1])to where all rows that have a [COST] column value of NULL are updated to a [COST] value of 0.00.

Can anyone show me how this is properly done? I've found examples for how to update EVERY row value for the column, but haven't quite been able to piece together the WHERE condition in a functional way.

Analytic Lunatic
  • 3,853
  • 22
  • 78
  • 120
  • Possible duplicate of [Update columns with Null values](http://stackoverflow.com/questions/3923721/update-columns-with-null-values) – Muhammad Muazzam Dec 17 '15 at 17:54

1 Answers1

11

You can test for a NULL value in a column using IS NULL.

UPDATE Table1
    SET cost = 0
    WHERE cost IS NULL;
Joe Stefanelli
  • 132,803
  • 19
  • 237
  • 235