Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
Lesnet
Starting Member
2 Posts |
Posted - 2008-10-15 : 18:41:30
|
| Newbie here Team - sorry...I'm building my first application from scratch. Its a light duty application for tracking OSHA accident rates. How do I avoid the divide by zero error in the following computed column statement when the NumberRecIndcidents is zero?(CONVERT([decimal]6,2),([HrsWorked]/[NumberRecIncidents]))Thanks in advance for helping.Scott |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-10-15 : 20:55:13
|
| Or use Nullif in denominator |
 |
|
|
tkizer
Almighty SQL Goddess
38200 Posts |
|
|
sodeep
Master Smack Fu Yak Hacker
7174 Posts |
Posted - 2008-10-15 : 23:11:00
|
I am talking about this one: or SET ARITHABORT OFF and SET ANSI_WARNINGS OFF .quote: Originally posted by Lesnet Newbie here Team - sorry...I'm building my first application from scratch. Its a light duty application for tracking OSHA accident rates. How do I avoid the divide by zero error in the following computed column statement when the NumberRecIndcidents is zero?(CONVERT([decimal]6,2),ISNULL([HrsWorked]/NULLIF[NumberRecIncidents],0),0))Thanks in advance for helping.Scott
|
 |
|
|
|
|
|