Results 1 to 2 of 2
  1. #1
    Join Date
    May 2004
    Posts
    144

    Unanswered: Problem with iif

    hi
    i have problem with using iif in sql statement, i assume this one should work:

    in pubs:
    select *,IIf(min_lvl>25, "Yes", "No") from jobs

    but it return error like this :

    Line 1: Incorrect syntax near '>'.

  2. #2
    Join Date
    Feb 2004
    Location
    In front of the computer
    Posts
    15,579
    Provided Answers: 54
    There isn't an IIf() function in Transact-SQL. You need to use the SQL CASE statement instead.
    Code:
    SELECT *, CASE WHEN min_lvl>25 THEN 'Yes' ELSE 'No' END
       FROM jobs
    -PatP
    In theory, theory and practice are identical. In practice, theory and practice are unrelated.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •