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
What are group functions in query statements in ms sql server?
How to stop log file growing too big?
What is data modeling and Reterminal integrity?
What method is used by the Command classes to execute SQL statements that return single values?
How do I find information about the install locations for the various instances running on a computer?
How to sort query output in descending order in ms sql server?
What is xdr?
Can you change the data type of a column in a table after the table has been created? If so, which command would you use?
Why is replication required on the sql server?
In which format does an image save in SQL Server database ?
What is update locks?
What does normalization do to data?
What is a non clustered primary key?
How do you rebuild an identity column?