Divide by zero in Stored procedure (MS Access project)

  • Thread starter Thread starter lemes_m
  • Start date Start date
It's impossible to say what's the best way of solving your particular
problem since you haven't given us any clues about what code you actually
have in your stored proc. However, the SQL Server CASE function is the
usual answer when you need an "equivalent" to the Access Iif function (it
isn't exactly an equivalent, but you can do the same sort of things with
it).
 
He's doing this in a Stored Procedure, there is no Switch function nor
Select Case statement.
 
Baz je napisao/la:
It's impossible to say what's the best way of solving your particular
problem since you haven't given us any clues about what code you actually
have in your stored proc. However, the SQL Server CASE function is the
usual answer when you need an "equivalent" to the Access Iif function (it
isn't exactly an equivalent, but you can do the same sort of things with
it).

I need to solve the problem with 'divide by zero' and formula in MS
Access query grid for this is:
Expr1:IIF(Field2=0,0,Field1/Field2)

I would like to get same result but in SP.

Thanks in advance
 
CASE WHEN Field2 = 0 THEN 0 ELSE Field1/Field2 END

If you are going to do much in the way of stored procedures you are going to
need to get SQL Server Books Online, not sure if it is downloadable from
Microsoft's web site.
 
A SQL Server stored procedure, what other kind is there? And no, VBA
functions cannot be used in stored procedures.
 
Back
Top