Thread: IIf condition

    #1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2003
    Posts
    55
    Rep Power
    11

    IIf condition


    I am trying to use IIf in the SQL statement as follows:

    IIf([PNumber]=Null,[IPNumber],[PNumber]) As Phone

    If the condition is true, it should return IPNumber but it is giving PNumber in the results. Am I doing something wrong?
  2. #2
  3. No Profile Picture
    Grumpier old Moderator
    Devshed Supreme Being (6500+ posts)

    Join Date
    Jun 2003
    Posts
    14,430
    Rep Power
    4539
    IIF is a MS Access only function, I think.

    For SQL Server try using CASE
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Regular (2000 - 2499 posts)

    Join Date
    Jan 2003
    Location
    Paris Uppland
    Posts
    2,377
    Rep Power
    391
    If([PNumber] is Null,[IPNumber],[PNumber]) As Phone

IMN logo majestic logo threadwatch logo seochat tools logo