ELIMINATE DIVIDE BY ZERO

To Eliminate the divide by zero error in a calculation in SQL 2005.

To Eliminate the divide by zero error in a calculation in SQL 2005 use the following:

DECLARE @a money, @b int
SELECT @a=1, @b=0
SELECT     ISNULL(@a/NULLIF(@b,0),0)
By Jason S   Popularity  (1882 Views)