Results 1 to 3 of 3

Thread: [RESOLVED] Error in Function SQL Server

  1. #1

    Thread Starter
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Resolved [RESOLVED] Error in Function SQL Server

    I have a field like this in a query:
    Code:
    IIF(flgNoSurvey = 1, Null, ISNULL(SomeIntegerField,0)) AS TotalNew
    This works, but every time I run the query, though it always functions, I also always get an error message:

    Error in list of function arguments: '=' not recognized.
    Unable to parse query text.

    What is causing that, and why bother when the query runs fine? Is this just telling me why SSMS can't diagram the query (which is actually a view, but it makes no real difference)?
    My usual boring signature: Nothing

  2. #2
    Angel of Code Niya's Avatar
    Join Date
    Nov 2011
    Posts
    9,017

    Re: Error in Function SQL Server

    I can't see why that is a problem but you could try this alternative:-
    Code:
    CASE 
        WHEN flgNoSurvey = 1 THEN NULL
        ELSE ISNULL(SomeIntegerField, 0)
    END AS TotalNew
    Treeview with NodeAdded/NodesRemoved events | BlinkLabel control | Calculate Permutations | Object Enums | ComboBox with centered items | .Net Internals article(not mine) | Wizard Control | Understanding Multi-Threading | Simple file compression | Demon Arena

    Copy/move files using Windows Shell | I'm not wanted

    C++ programmers will dismiss you as a cretinous simpleton for your inability to keep track of pointers chained 6 levels deep and Java programmers will pillory you for buying into the evils of Microsoft. Meanwhile C# programmers will get paid just a little bit more than you for writing exactly the same code and VB6 programmers will continue to whitter on about "footprints". - FunkyDexter

    There's just no reason to use garbage like InputBox. - jmcilhinney

    The threads I start are Niya and Olaf free zones. No arguing about the benefits of VB6 over .NET here please. Happiness must reign. - yereverluvinuncleber

  3. #3

    Thread Starter
    Super Moderator Shaggy Hiker's Avatar
    Join Date
    Aug 2002
    Location
    Idaho
    Posts
    40,109

    Re: Error in Function SQL Server

    Yeah, I should see whether it has any objections to that one.

    That worked fine. Of course, to some extent, that makes the mystery deeper, as the only "=" in the original IIF is still there in the CASE statement, but in CASE, it is fine, while in IIF...it works, but also shows an error message.
    Last edited by Shaggy Hiker; Dec 5th, 2024 at 07:02 PM.
    My usual boring signature: Nothing

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