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 |
|
mdelgado
Posting Yak Master
141 Posts |
Posted - 2002-04-12 : 16:36:54
|
| Hello all.I'm trying to update a table called 'maindetail' using the criteria shown below.However, as soon as I encounter a 'Divide by Zero' error, the script aborts and doesn't continue updating the table.Please help - thanks.Below is a piece of the T-sql script I'm using.update [maindetail]set spiff = [commission profit]*.25WHERE ([ITEM-NO] LIKE 'h222%') AND (COACH LIKE 'Reseller Sale%') AND(entrydate >= CONVERT(DATETIME, '2002-02-22 00:00:00', 102)) AND ([Commission Profit] / PRICE >= .3) |
|
|
JamesT
Yak Posting Veteran
97 Posts |
Posted - 2002-04-12 : 17:09:41
|
| Would this work for you?update [maindetail] set spiff = [commission profit]*.25 WHERE ([ITEM-NO] LIKE 'h222%') AND (COACH LIKE 'Reseller Sale%') AND (entrydate >= CONVERT(DATETIME, '2002-02-22 00:00:00', 102)) AND case when price = 0 then 0 else [Commission Profit] / PRICE end >= .3 |
 |
|
|
mdelgado
Posting Yak Master
141 Posts |
Posted - 2002-04-12 : 17:20:30
|
| EXCELLENT!thank you. |
 |
|
|
|
|
|