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 / ganapathi
solution 1:
update table_name set
salary = isnull(salary,0) + 100
solution 2:
update table_name set
salary = case when
salary is null then 100
else salary + 100
end
| Is This Answer Correct ? | 49 Yes | 1 No |
Post New Answer View All Answers
What is the default server name for sql server?
what are constraints? : Sql server database administration
What are the ways available in sql server to execute sql statements?
Explain the benefits of user-defined functions?
code to create procedure for taking databse backup in sql server or i have the query for it but what it's query returns means i want to show on my jsp that the databse backup has been taken on the basis of that return value.does it returns 0 or 1.wat is the code for that
What are extended events in sql server?
What is field with example?
What do you mean by authentication modes in sql server?
What is temporal data type?
What is an identity?
What is meant by dirty read?
Why is there a performance difference between two similar queries where one uses union and the other uses union all?
What is application role in sql server database security? : sql server security
What is the use of builtinadministrators group in sql server? : sql server security
Give an example of SQL injection attack ?