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 is a dataset and what are the different types of datasets?
which table keeps the locking information? : Sql server administration
What is similarity and difference between truncate and delete in sql?
What is the largest component inside a field?
what's the difference between delete table and truncate table commands? : Sql server database administration
What do you understand by SQL*Net?
Explain the properties of a relational table?
Write a SQL command to insert and update only a particular field?
Explain the various types of concurrency problem. I.e. Lost or buried updates, uncommitted dependency, inconsistent analysis, phantom read?
how would you improve etl (extract, transform, load) throughput?
What is the most common trace flags used with sql server?
Explain full-text query in sql server?
What are the different type of replication in sql server?
Tell me about the approaches which you used to counter the DI problems.
Explain the ways to controlling cursor behavior?