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
What are pessimistic lock and optimistic lock?
What is the recommended total size of your memory optimized tables?
List some of the rules that apply to creating and using a ‘view’
when you create a database how is it stored? : Sql server database administration
Explain sql server authentication modes?
Mention what are the different types of ssrs reports?
What is the filtered index?
Name few endpoints exposed by ssrs 2012?
What is the name of the Database which IBM mainframe uses?
what is the difference between them (ethernet networks and token ring networks)? : Sql server database administration
What is the sql server agent?
List all the types of user-defined functions?
Write the syntax for stuff function in an sql server?
Indexes are updated automatically is the full-text index also updated automatically?
How do I find the transaction log size in sql server?