karl;
Dont avoid dividing by Zero. SQL has a very good facility to overcome that. For instance, run these 2 queries and tell me the results:
(1)
SET @a = 2;
SET @b-2 = 0
SELECT @a/@b;
(2)
SET @a = 2;
SET @b-2 = 0
SELECT @a/ NULLIF(@b,0);
ALTERNATIVELY, you dont want a NULL but 0 : SELECT ISNULL(@a/NULLIF(@b,0),0)
This issue should not be a show stopper! Always use it when doing divisions, you will not feel bad.....