I have Column named 'Price' in a table.I want to update the 'Price' Column by adding 5 .But i have some Null values in 'Price' Column.Whenever i update the 'Price' Column.All Values Updated Except the Null Values Column.So how can i update the null Column.Pls Help

Alok

Recommended Answers

All 3 Replies

first do you first update, then:

update whattable set price = 5 where price IS NULL

From now onwards, all goods without price before will now cost 5 yourPriceUnit. Is this really correct?

krs,
tesu

Yes...keep in mind you can't do arithmitic operations with null values.

Write the following query:

update Tablename set columnName = coalesce(columnname,0) + AdditionValue


You will get desired result.. :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.