Tip of the Day : Differences Between ISNULL and COALESCE Functions

Welcome to SQL Server Helper !!!

This site is intended for those who are beginning to use SQL Server as part of their day-to-day activities.  You will find in this site a collection of useful functions, triggers, stored procedures and tips and tricks related to SQL Server.

Should you have any comments or questions regarding this site or if you want to ask SQL Server-related questions, e-mail us here.

We hope we are able to help and we are glad to help!!!

SQL Server Tip of the Day - October 18, 2025

Differences Between ISNULL and COALESCE Functions

The ISNULL function replaces NULL with the specified replacement value. 

ISNULL ( check_expression, replacement_value )

The COALESCE function returns the first non-NULL expression among its arguments.

COALESCE ( expression_1, expression_2 [, … expression_n] )

Here's a list of differences between the ISNULL function and the COALESCE function:

ISNULL

COALESCE

Takes only 2 parameters.

Takes a variable number of parameters.

A proprietary T-SQL function.

ANSI SQL standard.

Data type returned is the data type of the first parameter.

Data type returned is the expression with the highest data type precedence.  If all expressions are non-nullable, the result is typed as non-nullable.

Built-in function implemented in the database engine.

Translates to a CASE expression:

COALESCE (exp_1, exp_2, … exp_n)

Translates to

CASE
WHEN exp_1 IS NOT NULL THEN exp_1
WHEN exp_2 IS NOT NULL THEN exp_2

ELSE exp_n
END

If the data types of both parameters are not determined, the data type returned is int.

ISNULL(NULL, NULL) – Returns int

At least one of the NULL values must be a typed NULL.  If the data types of all parameters are not determined, the COALESCE function will throw an error:

COALESCE(NULL, NULL) – Throws an error

COALESCE(CAST(NULL AS INT), NULL) – Returns int

SQL Server 2012

SQL Server 2008

User-Defined Functions

Date Functions

A collection of useful user-defined functions that deal with dates.

String Functions

A collection of useful user-defined functions that deal with strings (varchar/char/nvarchar/nchar).

Tree Functions

A collection of useful user-defined functions that deal with tree or hierarchical design structures.

Table-Valued Functions

A collection of useful table-valued user-defined functions that can be used to join with other tables.

SQL Server Built-in Functions

A reference to all built-in functions available within SQL Server grouped into categories.

Tips and Tricks

A collection of useful SQL Server-related tips and tricks:

SQL Server Error Messages

A list of SQL Server error messages and for certain error messages, discusses ways on how to solve the error or work around them:

Frequently Asked Questions