dataengref migrate

Home / SQL Server

SQL Server ISNULL in Snowflake, Databricks and BigQuery

SQL Server ISNULL(x, y) becomes IFNULL in Snowflake and BigQuery, and IFNULL or NVL in Databricks. Do not keep the name ISNULL: Snowflake has no ISNULL function, and Databricks isnull(x) is a one-argument test that returns a boolean.

SQL Server function: ISNULL(check_expression, replacement_value) · SQL Server docs

Equivalents

TargetSupportSyntaxNotesSource
SnowflakeDifferent nameIFNULL(expr1, expr2)NVL(expr1, expr2) is the same function. COALESCE also works and accepts more than two arguments.Snowflake docs
DatabricksDifferent nameifnull(expr1, expr2)nvl(expr1, expr2) is a synonym. Both are documented as coalesce with two arguments. The built-in isnull(expr) only returns true or false.Databricks docs
BigQueryDifferent nameIFNULL(expr, null_result)COALESCE(expr, null_result) is equivalent.BigQuery docs

Behavior differences to check

Databricks

Examples

Default a missing discount to zero

SQL Server
SELECT order_id, ISNULL(discount, 0) AS discount FROM orders;
Snowflake
SELECT order_id, IFNULL(discount, 0) AS discount FROM orders;
Databricks
SELECT order_id, ifnull(discount, 0) AS discount FROM orders;
BigQuery
SELECT order_id, IFNULL(discount, 0) AS discount FROM orders;

Other SQL Server functions

Last checked: · Paste a whole query into the SQL checker to find every function that needs a change.