Results 1 to 3 of 3

Thread: [RESOLVED] [2005] Select Iif()...

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    617

    Resolved [RESOLVED] [2005] Select Iif()...

    is it possible to use IIF() in TSQL

    Code:
    select IIF(pk_pono='NA',pk_rfgno,pk_pono)
    from tblrequisitionmaster
    im using the code in MS ACCESS but doesnt work in SQL Server

  2. #2
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,222

    Re: [2005] Select Iif()...

    In T-SQL you would use CASE.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

  3. #3

    Thread Starter
    Fanatic Member
    Join Date
    Jul 2007
    Posts
    617

    Re: [2005] Select Iif()...

    perfect! thnx.

    select
    case pk_pono
    when 'NA' then pk_rfgno
    else pk_pono
    end

Posting Permissions

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



Click Here to Expand Forum to Full Width