Could not use IIF in a stored procedure

  • Thread starter Thread starter Hedi
  • Start date Start date
H

Hedi

Can some one help please, I am trying to use IIF inside a
stored procedure but it does not compile:
IFF(T1.Units=0,0,T2.Costs/T1.Units) AS CostPerUnits

Thanks
 
You can't use iff. You have to use the CASE keyword. Check it out in
Books Online. It's not that big of a difference. I ran into the same
problem a few months ago.

Bill
 
I used a user-defined function to return 1 when the value
is 0, empty, or Null. I thought if I use a function I can
reuse it again. Is this Ok?

Thanks
Hedi
 
Is it an Access UDF?

You cannot use an Access UDF since the MS-SQL Server
doesn't know about the Access UDF.

If you want to use a function, use the MS-SQL Server UDF.

Personally, I simply use the MS-SQL CASE construct.

HTH
Van T. Dinh
MVP (Access)
 
Back
Top