Division by zero error handling
I need a little guidance here. To make a long story short, I have a string which would be "(123/0)+23". I need to put that string in a dynamic query. However, I want to avoid the division by zero error.
if charindex('/0',@DynamicNumber) <> 0
that won't work here, because I can have 0.002...
Is there a way to do the update query: update #output set Column = @DynamicNumber
and catch the error if I get a division by zero. In that case, I would just like to let the cell as a null value.
Thanks for your help
David Lemire, Consultant
System Technologies for Industries Inc.