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 stored procedure can you use to display the current processes? : Sql server administration

1051


How to insert new line characters into strings?

1028


How to use “drop” keyword in sql server and give an example?

1185


What is the advantage of sql server?

1078


How to define the name and server for a new dsn?

1193


According to you what goes into making the best database administrator? : sql server database administration

1020


Define model database?

1029


What is the use of =,==,=== operators?

1057


Explain alternate key, candidate key and composite key in sql server?

946


How to end a stored procedure properly in ms sql server?

1139


How do users use Report Builder with SQL Server data sources?

164


Can we use trigger new in before insert?

955


What is the purpose of optimization?

1054


What is the distinction amongst delete and truncate?

1110


What is cdc in sql server?

1042