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

What are pessimistic lock and optimistic lock?

1069


Can you please explain the difference between primary keys and foreign keys?

1102


How to filter out duplications in the returning rows in ms sql server?

1131


Can you explain full-text query in sql server?

1009


How is foreign key related to primary key?

966


How to assign new column names in a view?

913


Describe in brief databases and sql server databases architecture.

1007


How do I completely remove sql server instance?

1095


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

1128


What does the not null constraint do?

1077


What is @@rowcount in sql?

1002


How do you handle datasets larger than 50 gb?

162


What is dbcc?

1130


What are “unrepeatable reads”?

1229


Explain what is the main purpose of having conversation group?

930