Use of ISNULL function in SQLserver and IFNULL function in Mysql, isnullifnull
This article introduces the isnull function in SQL server and ifnull function in mysql, and introduces the specific usage and differences between the two. If you are interested, you can study it.
First, let's look at the ISNULL function of SQL Serve:
ISNULL (check_expression, replacement_value)
1. The check_expression and replacement_value data types must be consistent.
2. If check_expression is NULL, replacement_value is returned.
3. If check_expression is NULL, return check_expression.
Let's take a look at the IFNULL function of Mysql:
IFNULL (expr1, expr2)
If expr1 is not NULL, IFNULL () returns expr1; otherwise, expr2 is returned.
The following describes the specific usage of ISNULL and NULLIF in SQLServer.
ISNULL in SQL Server is different from IsNull in ASP. SQL Server has two parameters.
I. ISNULL Syntax:
ISNULL (check_expression, replacement_value)
1. The check_expression and replacement_value data types must be consistent.
2. If check_expression is NULL, replacement_value is returned.
3. If check_expression is not NULL, the system returns check_expression.
2. NULLIF is used to check two expressions.
Syntax:
NULLIF (expression, expression)
Note:
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 expressio is returned.