Hello,
I just ran into a problem with an update statement in a stored procedure that cursors through a table. In my statement I SELECT a formula and sometime the formula can create a divide by zero fault. How can I avoid the divide by zero error?
I just ran into a problem with an update statement in a stored procedure that cursors through a table. In my statement I SELECT a formula and sometime the formula can create a divide by zero fault. How can I avoid the divide by zero error?
Code:
UPDATE MyTable
SELECT [C1] = 1 / (5 - [C2])
-- IF [C2] value = 5 the update fails
-- IF [C2] value < 5 the update works