Monday, July 25, 2005 5:58:42 PM UTC :: Filed Under SQL

Neither humans nor computes can divide by zero, so if your SQL script has a variable in the denominator of an equation, be sure to safe-guard against a potential divide-by-zero error:

CASE
    WHEN @AveWorkDays = 0 THEN 0
ELSE
    ISNULL(SUM(CAST(ItemInventory.QtyDistributed As decimal))/@AveWorkDays, 0)
END
Navigation
On this page....
Search
Archives
<July 2005>
SunMonTueWedThuFriSat
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456
Categories
Contact me
Send mail to the author(s) Contact Todd M. Taylor