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 / ganapathi

solution 1:
update table_name set
salary = isnull(salary,0) + 100

solution 2:
update table_name set
salary = case when
salary is null then 100
else salary + 100
end

Is This Answer Correct ?    49 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the concept of view and Types of views in SQL server?

941


What is the difference between locking and multi-versioning?

939


Does sql server 2000 full-text search support clustering?

814


What are synonyms?

913


What is stored procedures?

955


What does Master database contains?

1083


how you can move data or databases between servers and databases in sql server? : Sql server administration

915


How to concatenate two character strings together?

1056


What are sql servers used for?

980


How to stop log file growing too big?

954


How to create user defined functions with parameters?

1163


Is it true, that there is no difference between a rule and a check constraint?

972


What are constraints in microsoft sql server?

1037


Is mysql the same as sql server?

913


How to round a numeric value to a specific precision?

1011