Home Forums SQL Server 2005 T-SQL (SS2K5) Division by zero on a SQL Instance while a different Instance run correctly RE: Division by zero on a SQL Instance while a different Instance run correctly

  • odepriester (9/6/2013)


    btw, wouldn't it be better writing your example query more like :

    SELECT * FROM t

    WHERE (a<>0) and (b= 2 * a)

    ?

    It will avoid the "CASE" term

    Sometimes a rewrite like that would work, but if 'a=2' and 'b=5' are integers, then

    b/a = 2

    but

    b <> 2*a