Class NullIf
- Namespace
- YndigoBlue.Velocity.Functions
- Assembly
- YndigoBlue.Velocity.dll
Represents the NULLIF function that returns NULL if two expressions are equal, otherwise returns the first expression.
public class NullIf : Function, IElement, ICheckItem, IDefaultItem, IFilterItem
- Inheritance
-
NullIf
- Implements
Remarks
The NULLIF function compares two expressions and returns NULL if they are equal, otherwise it returns the first expression. This is equivalent to: CASE WHEN expr1 = expr2 THEN NULL ELSE expr1 END. NULLIF is useful for converting specific values to NULL (e.g., converting empty strings or sentinel values like -1 to NULL), preventing division by zero, or normalizing data.
Constructors
- NullIf(IElement, IElement)
Initializes a new instance of NULLIF with generic element-based arguments.
- NullIf(Column, double)
Initializes a new instance of NULLIF with a column and a double literal.
- NullIf(Column, int)
Initializes a new instance of NULLIF with a column and an integer literal.
- NullIf(Column, string)
Initializes a new instance of NULLIF with a column and a string literal.
- NullIf(Column, Column)
Initializes a new instance of NULLIF with column-based expressions.
- NullIf(Expression, Expression)
Initializes a new instance of NULLIF with expression-based arguments.