Flash cards
Review the key moves
1/4
Core idea
What is the main idea behind SQL Server IIF() Function?
Lesson checks
Practice each idea before moving on
Short Mimo-style checks built from this lesson's code, terms, and sequence.
1Quick choice
Which statement best captures the main point of this lesson?
2Fill blank
Complete the missing token from the example code.
___(500<1000, 'YES', 'NO');3Order
Put the learning moves in the order that makes the concept easiest to apply.
The IIF() function returns a value if a condition is TRUE, or another value if a condition is FALSE.
Definition and Usage
SQL Server IIF() Function
Example
SELECT
IIF(500<1000, 'YES', 'NO');Definition and Usage
The IIF() function returns a value if a condition is TRUE, or another value if a condition is FALSE.
Syntax
IIF(
condition
,
value_if_true
,
value_if_false
)Parameter Values
| Parameter | Description |
|---|---|
| condition | Required. The value to test |
| value_if_true | Optional. The value to return if condition is TRUE |
| value_if_false | Optional. The value to return if condition is FALSE |
Technical Details
| Works in: | SQL Server (starting with 2012), Azure SQL Database |
|---|