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
How do I create a stored procedure in sql server?
As a general practice, it is recommended to have dbo be the owner of all database objects however, in your database you find number of tables owned by a user other than dbo, how could you fix this?
What are the new features in sql server 2016?
What is an identity column in insert statements?
What is tabulation?
What is a group function explain with an example?
What is inline variable assignment?
Why we use trigger in sql server with example?
What is the function of inner join?
Is truncate autocommit?
Can sql server be linked with other servers like oracle?
Define synonym?
How to create a new schema in a database?
What are the difference between primary key and unique key? : sql server database administration
Do you know what are the ways available in sql server to execute sql statements?