Results 1 to 4 of 4
  1. #1
    kei_law is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Posts
    2

    Translating access query IIF syntax to SQL Server

    Hello All,

    I'm looking at the following Access Query line:

    Code:
    HAVING (((IIf([QRY_003_Assoicates_JC_Overrides] ! [Sec_JobCode] ! [Role_Group] <> [QRY_003_Assoicates_JC_Overrides] ! [Sec_JobCode_1] ! [Role_Group], "Send", "Ignore")) = "Send"));
    




    Here is my translation to SQL Server syntax:

    Code:
    HAVING casewhen [QRY_003_Assoicates_JC_Overrides] . [Sec_JobCode].[Role_Group] <> [QRY_003_Assoicates_JC_Overrides].[Sec_JobCode_1].[Role_Group]
    then'send'else'Ignore'='Send';
    


    editor does not like the "=" at the very end of the line. Any ideas what it should be there?


    thanks,
    Keith



  2. #2
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    You missed the "End". Try

    ...else 'Ignore' END ='Send'

    IIf() works in SQL Server starting with 2012 (I think).
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

  3. #3
    kei_law is offline Novice
    Windows 10 Access 2016
    Join Date
    Mar 2019
    Posts
    2
    thank you pbaldy. That was the missing piece. I actually tried putting the END after 'Send' but no good.

  4. #4
    pbaldy's Avatar
    pbaldy is offline Who is John Galt?
    Windows XP Access 2007
    Join Date
    Feb 2010
    Location
    Nevada, USA
    Posts
    22,518
    Happy to help, and welcome to the site by the way!
    Paul (wino moderator)
    MS Access MVP 2007-2019
    www.BaldyWeb.com

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Convert SQL Server Syntax To Access Query Syntax
    By chalupabatman in forum Queries
    Replies: 1
    Last Post: 10-18-2017, 08:53 PM
  2. Replies: 19
    Last Post: 07-13-2015, 10:15 AM
  3. Replies: 14
    Last Post: 07-07-2015, 07:39 PM
  4. Replies: 2
    Last Post: 08-25-2014, 03:09 PM
  5. Replies: 3
    Last Post: 03-21-2014, 04:28 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums