Hi I'm trying to calculate 2 columns values based upon a case depending on what is in a 3rd column.
the code below errors with Error converting datatype varchar to numeric.
I believe it is trying to set the Currency Column to the new value instead of test.
can anyone help on my syntax.
Thankyou.
SELECT dbo.ORDR.DocTotal,
dbo.ORDR.DocTotalFC,
test = case
when dbo.RDR1.Currency = 'GBP' then dbo.ORDR.DocTotal - dbo.ORDR.VatSum
when dbo.RDR1.Currency = 'USD' then dbo.ORDR.DocTotalFC - dbo.ORDR.VatSumFC
when dbo.RDR1.Currency = 'EUR' then dbo.ORDR.DocTotalFC - dbo.ORDR.VatSumFC
else 'other'
end
FROM dbo.RDR1 INNER JOIN
dbo.ORDR ON dbo.RDR1.DocEntry = dbo.ORDR.DocEntry