Do I need both conditions in IIf function?

故事扮演 提交于 2019-12-24 21:08:00

问题


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?


回答1:


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.



来源:https://stackoverflow.com/questions/53205326/do-i-need-both-conditions-in-iif-function

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!