Could not use IIF in a stored procedure

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
 
B

Bill

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
 
H

Hedi

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
 
V

Van T. Dinh

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)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top