Hi @Analyst_SQL
ISNULL: Replaces NULL with the specified replacement value.
However in this sample, 'ConWEight' is blank value instead of NULL. Therefore you could use NULLIF to turn ' ' to NULL first and then use ISNULL, like this:
SELECT convert(numeric(10,2),(isnull(nullif(c.ConWeight,''),0)*c.Container_Rate)+c.Trucking_Charges) as Invoice_Amount
FROM #Containerno c
Best regards,
LiHong
If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our Documentation to enable e-mail notifications if you want to receive the related email notification for this thread.