Beginner

288. ISNULL Function

Learn how SQL Server uses ISNULL to replace NULL values with an alternative value.

📘 Lesson 288 of 728 ⏱ 9 min 🎯 Intermediate

ISNULL is commonly used in SQL Server to return a replacement value when the first expression is NULL.

Missing values can make reports difficult to understand. ISNULL provides a simple way to display a meaningful fallback value.

Display zero when a commission amount is NULL.

SQL
SELECT
    EmployeeName,
    ISNULL(Commission, 0) AS Commission
FROM Employees;

ISNULL is commonly used in SQL Server reporting, financial calculations, dashboards, and data preparation.

  • ISNULL handles NULL values.
  • It is commonly associated with SQL Server.
  • It returns a replacement value for NULL.
  • It is useful in reports.
  • COALESCE is generally more portable.
What does ISNULL do?

ISNULL returns a replacement value when the supplied expression is NULL.

Is ISNULL standard across all databases?

No. ISNULL is database-specific, while COALESCE is generally more portable SQL.

Have you finished this lesson?

Introduction to SQL – All Lessons