IIF



Short for "immediate if": returns whenTrue when the condition is true and whenFalse otherwise. The condition is usually one of the boolean functions such as IsEqual or IsGreater.

String IIF(Boolean condition, String whenTrue, String whenFalse)

Conditions

The condition must be a function call. Comparison operators such as 1 = 1 are only supported in WHERE and ON clauses.


round-pushpin Flags the rows where the English text is exactly 'cats'.
SELECT
    English,
    IIF(IsEqual(English, 'cats'), 'YES!', 'no...') as IsCats
FROM
    WordList:FlatTranslate
WHERE
    English LIKE '%cats'

round-pushpin Nests functions in the condition.
SELECT IIF(IsGreater(Length('Hello World'), 10), 'Is True', 'Is False') as Result FROM Single




SQL :: IsNotLike
Returns true (1) if the text does not match the pattern. See Like for the wildcards.
SQL :: IsNull
Returns true (1) if the given value is null, otherwise false (0). This is how to test for missing fields and for the unmatched side of an outer join.
SQL :: IsNumeric
Returns true (1) if the given value is a number: digits with an optional leading sign and an optional decimal point. Null and empty values return 0.
SQL :: IsString
Returns true (1) if the given value cannot be converted to a number.
SQL :: LastIndexOf
Returns the zero-based position of the last occurrence of textToFind in textToSearch. Returns -1 when it is not found.
SQL :: Left
Returns the given number of characters from the start of the value.
SQL :: Length
Returns the number of characters in the given value.
SQL :: NullIf
Returns null when the conditional is true, otherwise returns the value.
SQL :: NullIfNumeric
Returns null when the conditional is true, otherwise returns the number.
SQL :: NullWhen
Returns null when the value equals compareToValue, otherwise returns the value.