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
hi, how to link a text file and a .rpt file in my tables of sql server and to retrieve those records for further use. reply me as soon as possible.
What is the purpose of optimization?
What is the difference between rank and dense_rank?
What do you understand by intent locks?
What are clustered and non-clustered index?
How do you use a subquery to find records that exist in one table and do not exist in another?
What is self join in sql server joins?
What is the difference between ‘having’ clause and a ‘where’ clause?
What are the new features introduced in SQL Server 2000 (or the latest release of SQL Server at the time of your interview)? What changed between the previous version of SQL Server and the current version?
Why is normalisation important?
How you can add messages to the nt event log from within a stored procedure?
How to connect php with different port numbers?
What is the fastest way to permanently delete a 1 million row table named customers?
How does using a separate hard drive for several database objects improves performance right away?
How to get the definition of a stored procedure back?