IIF (condition-expr, true-expr, false-expr)
ECSQL supports IIF(), which is shorthand for CASE WHEN <condition-expr> THEN <true-expr> ELSE <false-expr> END
Parameters
condition-expr
: A condition expression that resolves into a boolean value. e.g. Length > 1.0.
true-expr
: Value returned when the condition-expr
is evaluated to a true value.
false-expr
: Value returned when the condition-expr
is evaluated to a false value.
Example
-- Returns 'Big' if Length is greater than 1, and 'Small' otherwise
SELECT IIF([Length] > 1.0, 'Big', 'Small') FROM [test].[Foo];
-- Returns DisplayLabel if Name is NULL, and Name otherwise
SELECT IIF([Name] IS NULL, [DisplayLabel], [Name]) FROM [test].[Foo];
Last Updated: 15 May, 2024
Found something wrong, missing, or unclear on this page?Raise an issue in our repo.