Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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 are the differences between user defined functions and stored procedures?

1078


Do you think BCNF is better than 2NF & 3NF? Why?

1278


Does group by or order by come first?

964


What is data file in computer?

956


Which are the new data types introduced in sql server 2008?

887


What is the report builder?

141


How to find the list of fixed hard drive and free space on server?

1205


how to invoke a trigger on demand? : Sql server database administration

1090


How to transfer a table from one schema to another?

1007


What is the usage of the sign function?

1118


What are different types of raid configurations? : SQL Server Architecture

1086


How fixed length strings are truncated and padded?

980


Why use “nolock” in sql server?

1064


Difference between aggregate functions of sql?

1107


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?

1040