SqlExpression NULLIF

From Eigenpedia

Jump to: navigation, search

Contents

Syntax

NULLIF( value1, value2 )

Purpose

Compares two values and returns NULL if they are equal, otherwise returns the first value. The two values must be of comparable type.

Input

  • value1 - first value to compare
  • value2 - second value to compare

Output

  • [NUMERIC] - null if value1 is equal to value2, otherwise returns value1.

Example

Function Result
NULLIF(1.5, 13.56) 1.5
NULLIF(1324.24, 90) 1324.24
NULLIF('a', cast(null as varchar(1))) a



Return to Built in Function details

Personal tools