Swaps a NULL for a substitute value in T-SQL. COALESCE takes any number of arguments, but this takes two and returns the first one's data type, which may truncate a longer substitute.
Read more: Microsoft Learn
In the Ultra Transcenders books
Each book explains ISNULL in context, with comparison tables and the common traps.
Terms in this definition
- NULL
Marks that a row has nothing in a particular column, as when a person has no middle name. Columns defined NOT NULL can never be left empty.
- T-SQL
The dialect of SQL that Microsoft uses for Azure SQL and SQL Server. Azure Monitor logs are queried with KQL instead.
- COALESCE
Picks the first argument that is not NULL. In T-SQL loads this is often used to replace a missing lookup result with an Unknown member key such as -1.
- FIRST
A DAX function available only inside visual calculations. It fetches the value at the start of one axis of the visual's matrix, which makes it handy for comparing each point with the first; its opposite is LAST.
- Data type
A rule limiting what a column may contain, for example INT for integers, DECIMAL for numbers with fractions or VARCHAR for text of varying length. Which types exist depends on the database product.