Curriculum
Course: SQL
Login

Curriculum

SQL

SQL References

0/80

MySQL Functions

0/139

SQL Server Functions

0/84

SQL Quick Ref

0/1
Text lesson

NULLIF

Example

Evaluate two expressions to determine their relationship.

SELECT NULLIF(2525);

Definition and Usage

The NULLIF() function returns NULL if two expressions are identical; otherwise, it returns the first expression.

Syntax

NULLIF(expr1expr2)

Parameter Values

Parameter

Description

expr1, expr2

Mandatory. The pair of expressions that are to be evaluated for comparison.

Technical Details

Works in:

 SQL Server (from 2008 onward), Azure SQL Database, Azure SQL Data Warehouse, and Parallel Data Warehouse

More Examples

Example

Evaluate two expressions for comparison.

SELECT NULLIF(‘Hello’‘Hello’);

Example

Evaluate two expressions for comparison.

SELECT NULLIF(‘Hello’‘world’);

Example

Evaluate two expressions for comparison.

SELECT NULLIF(‘2017-08-25’‘2017-08-25’);