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
Sql studio em braces a variety of capabilities, but will I need them all? Is there a simpler product ? : sql server management studio
Can you explain full-text query in sql server?
What is the purpose of update statistics and scope_identity() function?
How global temporary tables are represented and its scope?
What are the differences between decimal and float in ms sql server?
mention different types of relationships in the dbms?
Do I need a report server to run reports in my application?
Name 3 of the features that the sql server built-in function loginproperty performs on standard logins? : sql server security
how can u get last observation in an unknown dataset ?
What is dirty page?
Explain the xml support sql server extends?
Do you know how to implement service broker?
What is a non clustered primary key?
What to check if a User database is locked?
What is difference statement and preparedstatement?