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 are the events recorded in a transaction log?
What is replace and stuff function in sql server?
What is the minimum and maximum number of partitions required for a measure group? : sql server analysis services, ssas
What is intellisense?
Can binary strings be used in arithmetical operations?
How to generate create table script on an existing table in ms sql server?
What is dbcc command in sql server?
you want to be sure that queries in a database always execute at the maximum possible speed. To achieve this goal you have created various indexes on tables which other statement will keep the database in good condition? : Sql server administration
How does the report manager work in SSRS?
Explain concepts of analysis services?
What are the different types of subquery?
What are transactions and its controls?
When multiple after triggers are attached to sql table, how to control the order of execution?
Explain various data region available in ssrs with their use?
What is the difference between NOROW and LOCKROW?