ISNULL in MySQL and SQL Server

ISNULL function behaves differently in MySQL and Microsoft SQL Server.

In MySQL, ISNULL tests whether the given expression is NULL. It returns 1 if the expression is NULL otherwise it returns 0.

However, in SQL Server, the null values are replaced with user-defined values during the expression evaluation process.

Look at the below examples:

MySQL:
SELECT ISNULL(NULL);
It returns: 1

SQL Server:
SELECT ISNULL(NULL,’SomethingElse’);
It returns: SomethingElse

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s