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

Sql studio em braces a variety of capabilities, but will I need them all? Is there a simpler product ? : sql server management studio

863


Can you explain full-text query in sql server?

978


What is the purpose of update statistics and scope_identity() function?

1061


How global temporary tables are represented and its scope?

919


What are the differences between decimal and float in ms sql server?

1140


mention different types of relationships in the dbms?

973


Do I need a report server to run reports in my application?

157


Name 3 of the features that the sql server built-in function loginproperty performs on standard logins? : sql server security

1056


how can u get last observation in an unknown dataset ?

2398


What is dirty page?

931


Explain the xml support sql server extends?

997


Do you know how to implement service broker?

893


What is a non clustered primary key?

881


What to check if a User database is locked?

1030


What is difference statement and preparedstatement?

939