Carmine Scivetti
Carmine Scivetti

Reputation: 1

How to deal with division and null values in Navicat

for those experts in Navicat, I want to ask you one thing about SQL and the following issue: I found a table with two exchange rates columns and they were null in some records For the specific task I needed to set these nulls to 1 in my computation. The computation is to multiply the gross amount by a first exchange rate (first column), then divide by a second exchange rate (secon column), but since there are some null cases, I would like to set those nulls as 1 through isnull/nullif function.

I tried to write the syntax but up to now the attempts were not correct (Error message:Incorrect syntax near ","), my idea is the following:

try_cast(gross_amount as float) * isnull(try_cast(nar_exchange_rate as float),1)/isnull(try_cast(fx_rate as float),1)

Please tell me if it could be correct, because so far it seems the most reasonable syntax, but it doesn't work. Thanks in advance

Upvotes: 0

Views: 139

Answers (0)

Related Questions