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
Explain powershell included in sql server 2008?
What is a linked server in sql server?
Define synonym?
What is the server name for sql management studio?
How do I find the transaction log size in sql server?
What is partition in sql server?
Explain difference between control flow and data flow?
how to invoke a trigger on demand? : Sql server database administration
how to use DTS package in 2000,2005,2008 in sql server
how to overcome kernel isssues
Explain full-text query in sql server?
What different steps will a sql server developer take to secure sql server?
What happens when the SQL Azure database reaches Max Size?
How to query multiple tables jointly?
John exports information periodically from a microsoft sql server database to an oracle database what is the best way to do this?