Should work in PostgreSQL and MS SQL...
CASE
WHEN (Indx.Net_Exp_Starts > 0)
THEN (Indx.Inv/Indx.Net_Exp_Starts)
ELSE 0
END AS Yield
-----Original Message-----
From: Gonzo Rock [mailto:[EMAIL PROTECTED]
Sent: Friday, 17 June 2005 12:15 p.m.
To: CF-Talk
Subject: A Test for Division by Zero a SQL Query...
Select (Indx.Inv/Indx.Net_Exp_Starts) AS Yield from Indx Blows up when
Net_Exp_Starts = 0 with a Division by Zero SQL Error in postgreSQL
and MSSQL.
Does anyone know how can I return 0 as the yield when the divisor is 0?
Thanks soooo much,
Gonz
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Discover CFTicket - The leading ColdFusion Help Desk and Trouble
Ticket application
http://www.houseoffusion.com/banners/view.cfm?bannerid=48
Message: http://www.houseoffusion.com/lists.cfm/link=i:4:209765
Archives: http://www.houseoffusion.com/cf_lists/threads.cfm/4
Subscription: http://www.houseoffusion.com/lists.cfm/link=s:4
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4
Donations & Support: http://www.houseoffusion.com/tiny.cfm/54