I am trying to divide a decimal number by another decimal number.
I keep getting 'Divide by zero error encountered.' message.
The following is the statement.
The variables 2 & 3 are of varchar types, hence I am trying to convert them to decimal before the calculation.
variable1= case when variable2='NULL' or cast(variable3 as decimal) =0.0 then ' ' else cast(variable2 as decimal)/cast(variable3 as decimal) end,
I would very much appreciate if someone could help me to solve this problem.
Many Thanks
I keep getting 'Divide by zero error encountered.' message.
The following is the statement.
The variables 2 & 3 are of varchar types, hence I am trying to convert them to decimal before the calculation.
variable1= case when variable2='NULL' or cast(variable3 as decimal) =0.0 then ' ' else cast(variable2 as decimal)/cast(variable3 as decimal) end,
I would very much appreciate if someone could help me to solve this problem.
Many Thanks