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
what stored procedure can you use to display the current processes? : Sql server administration
How to insert new line characters into strings?
How to use “drop” keyword in sql server and give an example?
What is the advantage of sql server?
How to define the name and server for a new dsn?
According to you what goes into making the best database administrator? : sql server database administration
Define model database?
What is the use of =,==,=== operators?
Explain alternate key, candidate key and composite key in sql server?
How to end a stored procedure properly in ms sql server?
How do users use Report Builder with SQL Server data sources?
Can we use trigger new in before insert?
What is the purpose of optimization?
What is the distinction amongst delete and truncate?
What is cdc in sql server?