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

Which are the two editions in which SQL Azure database available?

101


How can we delete Duplicate row in table?

641


can a database be shrunk with users active? : Sql server administration

572


How to use linked server?

598


What is a subquery in a select query statement in ms sql server?

593






Does sql server use java?

523


You want to implement the one-to-many relationship while designing tables. How would you do it?

514


Explain about protocol layer present in SQL server?

611


Can we insert data into a view?

575


What is the report model project?

103


Can You Use A Stored Procedure To Provide Data To An Ssrs Report?

109


What is command parameter in ssrs?

120


Can two tables share the same primary key?

513


What is the difference between coalesce() & isnull()?

537


What is the status of services on passive node for failover cluster in sql server? : sql server database administration

639