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


Please Help Members By Posting Answers For Below Questions

What is dml command?

713


What is clustered primary key?

763


Describe different Processing Modes offered by SSRS?

202


What are the drawbacks of reporting in ssrs?

122


What are the different types of normalization?

808






What is ssrs?

109


Explain what is the difference between a local and a global temporary table?

704


Please explain the characteristics of a transaction server for example atomicity, consistency, isolation, durability?

674


What is difference between equi join and natural join?

710


how to overcome kernel isssues

1351


Explain a join?

780


What are the advantages of using stored procedures in sql server?

699


What is the user of Primary key?

737


What are the types of indexing?

820


What are synonyms?

714