Use of ISNULL function in SQLserver and IFNULL function in Mysql, isnullifnull

Source: Internet
Author: User

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.


Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.