isnull

Description

Substitutes the value specified in expression2 when expression1 evaluates to NULL.

Syntax

isnull(expression1, expression2)

Parameters

expression

is a column name, variable, constant expression, or a combination of any of these that evaluates to a single value. It can be of any datatype, including unichar. expression is usually a column name. If expression is a character constant, it must be enclosed in quotes.

Examples

Example 1

Returns all rows from the titles table, replacing null values in price with 0:

select isnull(price,0) 
from titles

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

Any user can execute isnull.

See also

Documentation Transact-SQL Users Guide

Function convert