SQL Server has two parameters. Syntax:
ISNULL (check_expression, replacement_value)
The check_expression and replacement_value data types must be consistent.
If check_expression is NULL, replacement_value is returned.
If check_expression is not NULL, check_expression is returned.
NULLIF is used to check two expressions. Syntax:
NULLIF (expression, expression)
If two expressions are equal, NULL is returned, which is the data type of the first expression.
If two expressions are not equal, the first expression is returned.
The two functions NULLIF and ISNULL in SQL Server are described as follows:
NULLIF: two parameters are required. If the two specified expressions are equivalent, null is returned.
Example: NULLIF (a, B)
Note: If a and B are equal, NULL is returned. If not, a is returned.
Select NULLIF ('eqeqweqw', '1'). The result is eqeqweqwe.
Select NULLIF () returns NULL
The types of a and B must be consistent.
ISNULL: two parameters are required. The objective is to replace null with the specified value. If the first parameter is not null, the first parameter is returned.
Example: ISNULL (a, B)
NOTE: If both a and B are NULL, NULL is returned. If a is NULL and B is not NULL, B is returned. If a is not NULL and B is NULL, a is returned, if neither a nor B is NULL, a is returned.
Select ISNULL (null, null) returns null
The result of select ISNULL (null, 33) is 33.
Select ISNULL ('ddd ', null) results in ddd
Select ISNULL () result is 44
Isnumeric: Check whether the expression is a valid number.