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 reportserver and reportservertempdb ?
Mention a few common trace flags used with sql server?
How to maintain a fill factor in existing indexes?
What are wait types?
What is 1nf 2nf?
How many types of subqueries are there in sql server?
Do you know what are the ways available in sql server to execute sql statements?
How many ways to create table-valued functions?
What is the server name for sql management studio?
What is auditing in sql server?
How do we know if any query is retrieving a large amount of data or very little data?
What is the order in which the sql query is executed?
What is a fan-out query in SQL Azure?
Explain about merge replications?
What are the dmvs?