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 |
AskSQLTeam
Ask SQLTeam Question
0 Posts |
Posted - 2003-06-02 : 08:07:20
|
sharon writes "Hi,I have this formula ....(IsNull(GVA_Amount,1)/(IsNull(GV.PaisPartPercent,100)/100)+GV.GrantAmount)+IsNull(SCHUM_MIMUN, 0) as MANOF_SCHUM_TOTALAa u see i can check if there is null at any filed i want.I would like to check if this filed value is zero also.The reason i need it couse sql can't divide by zero.how can i do that ??Thank uSHARON." |
|
JustinBigelow
SQL Gigolo
1157 Posts |
Posted - 2003-06-02 : 09:59:20
|
Access has a function called iif() it allows you to branch your logic depending on the results of a comparison. = iif(GVA_Amount = 0, 0, (IsNull(GVA_Amount,1)/(IsNull(GV.PaisPartPercent,100)/100)+GV.GrantAmount)+IsNull(SCHUM_MIMUN, 0))what this says is, if GVA_Amount is equal to zero then return zero (second argument of the function), if not equal to zero perform the computation (obviously the third agrument of the function).hth,Justin"Contrary to its syntax GETDATE() still leaves you alone on Friday night." |
 |
|
Nazim
A custom title
1408 Posts |
Posted - 2003-06-02 : 11:56:15
|
Nice one justin, but Here it is Wednesday night quote: "Contrary to its syntax GETDATE() still leaves you alone on Friday night."
-------------------------What lies behind you and what lies ahead of you are small matters compared to what lies within you.-Ralph Waldo Emerson |
 |
|
JustinBigelow
SQL Gigolo
1157 Posts |
Posted - 2003-06-02 : 16:53:01
|
Hey, welcome back Nazim. Justin"Contrary to its syntax GETDATE() still leaves you alone on Friday night." |
 |
|
|
|
|
|
|