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 the differences between user defined functions and stored procedures?
Do you think BCNF is better than 2NF & 3NF? Why?
Does group by or order by come first?
What is data file in computer?
Which are the new data types introduced in sql server 2008?
What is the report builder?
How to find the list of fixed hard drive and free space on server?
how to invoke a trigger on demand? : Sql server database administration
How to transfer a table from one schema to another?
What is the usage of the sign function?
What are different types of raid configurations? : SQL Server Architecture
How fixed length strings are truncated and padded?
Why use “nolock” in sql server?
Difference between aggregate functions of sql?
You schedule a job to run every minute what will happen if the first job runs more than 1 min? Will the second instance of the job start?