Quantcast
Channel: Embarcadero Community - Embarcadero Community
Viewing all articles
Browse latest Browse all 3212

How to update multiple rows of multiple columns with single value having same condition for every column

$
0
0

I have a table having different type of Fees like security fees, tuition fees, admission fees etc and all of these column accept null values too.

I want to update all null values of these columns with 0 value. I can write different update query for each column but because condition and value for all the SQL server columns is same I wanna learn to do it in a single update query.

Table_Fees
securityFees | TuitionFees | AdmissionFees
 150            500             null
 null           450              120
 150            null             120         

How can I replace all null values with zero?

Update Table_Fees
 set securityFees = 0,
     TuitionFees  = 0,
     AdmissionFees = 0
where securityFees = null
and   TuitionFees  = null
and   AdmissionFees = null;

or/and both operator are not useful in this case


Viewing all articles
Browse latest Browse all 3212

Latest Images

Trending Articles



Latest Images

<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>