how to update a null value field in sql server

eg
a table contains 3 fields id,name,salary
and 3 records
salary of 1 record is null
i want update the nullfield

111 arun 300
112 ddd 200
113 ttt null
i want to update table with add 100 to every record include null
after updation
the recrds should be
111 arun 400
112 ddd 300
113 ttt 100

Answer Posted / ganesh.k

UPDATE Table_Name SET Salary = COALESCE(Salary,0) + 100

(Or)

UPDATE Table_Name SET Salary = ISNULL(Salary,0) + 100

Is This Answer Correct ?    15 Yes 2 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is the purpose of floor function?

750


Can binary strings be used in arithmetical operations?

682


What are the 7 disadvantages to a manual system?

683


What is rtm version in sql server?

698


You want to use a perspective in an mdx query. How do you select the perspective?

185






Write the SQL query to drop, truncate and delete table.

726


The external application that is executed in one of the tasks does not have a log file, but only a screen log. How can I save the data from the screen? : sql server management studio

700


Please explain go command in sql server?

776


Does group by or order by come first?

713


How do I edit a procedure in sql server?

717


Can you explain how long are locks retained within the repeatable_read and serializable isolation levels, during a read operation with row-level locking?

742


How to name query output columns in ms sql server?

713


What is a collation in ms sql server?

718


What is a primary index?

697


What is resultset concur_updatable?

743