[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)?
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
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.