Skip to content
Advertisement

Do I need both conditions in IIf function?

I know the syntax of the IIf function in SQL is

IIf(Boolean_Expression, True_Value, False_Value)

But I just found a SQL Code where is written

IIf([DATE_USER_TO_SPECIALIST] Is Not Null, Year([DATE_USER_TO_SPECIALIST]) & "." & IIf(Month([DATE_USER_TO_SPECIALIST])<=9,"0","") & Month([DATE_USER_TO_SPECIALIST])) AS DATE_USER_TO_SPECIALIST_YYYYMM

And it works. But how? I can’t find the false value, or is the false value not required?

Advertisement

Answer

Jet-SQL has own build-in IIF function which allows you to omit false part. In this case it acts like you passed Null value for the third argument.

User contributions licensed under: CC BY-SA
10 People found this is helpful
Advertisement