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 / mohan
create table #temp (eid int, names varchar(10),sal int)
insert into #temp values (111, 'arun', 300)
insert into #temp values(112, 'ddd', 200)
insert into #temp values(113,'ttt',null)
select * from #temp
update #temp
set sal = isnull(sal,0)+ 100
select * from #temp
| Is This Answer Correct ? | 6 Yes | 2 No |
Post New Answer View All Answers
How do you start single user mode in clustered installations?
Explain timestamp datatype?
Can you explain important index characteristics?
Explain the difference between primary keys and foreign keys?
What guidelines should be followed to help minimize deadlocks?
To which devices can a backup be created and where should these devices be located? : sql server management studio
What different steps will a sql server developer take to secure sql server?
What do you understand by user-defined function in the sql server?
How do you run a trace?
Tell me in brief how sql server enhances scalability of the database system?
How do you delete duplicate records in sql server?
What is the use of attributehierarchyvisible ? : sql server analysis services, ssas
how can u get last observation in an unknown dataset ?
What do you mean by subquery?
How many types of database relationship in sql server?