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 are unicode character string data types in ms sql server?
Can primary key be a foreign key?
How do you delete duplicate rows in sql server?
What is ssl in sql server?
What is report snapshot?
What are the mathematical functions supported by sql server 2005?
how to control the amount of free space in your index pages? : Sql server database administration
How can you know if the row fetched from cursor is still valid in underlying table?
What is sql server english query?
Can a database be shrunk with users active?
What is the optimization being performed in oracle and SQL Server?
Which are ddl commands?
What are the steps you must follow to hide sql server instances?
What is replication with database mirroring? : sql server database administration
Differentiate between ms sql server reporting services vs crystal reports?