cancel
Showing results for 
Search instead for 
Did you mean: 

SQL IIF command

jbrotto
Active Contributor
0 Kudos
193

We got a new server and was looking over some SQL commands and the IIF seems to be easy to implement as it just compares values for a row level. Any siutation that would mmake sense in B1?

View Entire Topic
OlehFabri
Participant
0 Kudos

Hi Jonathan,

IIF function can simplify a query as you can avoid using a CASE expression. For example:

SELECT DocDueDate, IIF(DocDueDate<GETDATE(), 'OVERDUE', 'OK'), * FROM OINV

It checks the condition and returns the first value if the condition is true, and the second value if the condition is false.