Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
What are the practical differences between COALESCE() and ISNULL(,'')?
Home
Sql
What are the practical differences between COALESCE() and ISNULL(,'')?
+2
votes
asked
Jan 15, 2022
in
Sql
by
GeorgeBell
What are the practical differences between COALESCE() and ISNULL(,'')?
t-sql
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Jan 15, 2022
by
GeorgeBell
COALESCE() - Evaluates the arguments in order and returns the current value of the first expression that initially does not evaluate to NULL.
ISNULL() - Replaces NULL with the specified replacement value.
The ISNULL function and the COALESCE expression have a similar purpose but can behave differently:
COALESCE() is in the SQL '92 standard and supported by more different databases. If you go for portability, don't use ISNULL.
COALESCE() can have multiple inputs and it will evaluate in order until one of them is not null such as COALESCE(Col1, Col2, Col3, 'N/A'). It's recommended to use this by MS instead of ISNULL()
ISNULL() can only have one input, however it's been shown to be slightly faster than COALESCE.
Your comment on this answer:
Email me at this address if a comment is added after mine:
Email me if a comment is added after mine
Privacy: Your email address will only be used for sending these notifications.
Related questions
+2
votes
Q: What is the difference between PARTITION BY and GROUP BY
asked
Jan 15, 2022
in
Sql
by
GeorgeBell
t-sql
+2
votes
Q: What's the difference between TRUNCATE and DELETE in SQL?
asked
Jan 15, 2022
in
Sql
by
GeorgeBell
t-sql
+2
votes
Q: Is there a difference between T-SQL linked server and a synonym?
asked
Jan 14, 2022
in
Sql
by
GeorgeBell
t-sql
+2
votes
Q: What is the difference between EXEC vs sp_executesql?
asked
Jan 15, 2022
in
Sql
by
GeorgeBell
t-sql
+2
votes
Q: What are bitwise operators and what is the value from a database design perspective?
asked
Jan 15, 2022
in
Sql
by
GeorgeBell
t-sql
+2
votes
Q: What are ROLLUP and CUBE in T-SQL?
asked
Jan 14, 2022
in
Sql
by
GeorgeBell
t-sql
+2
votes
Q: How can you capture the length of a column when it is a Text, NText and/or Image data type?
asked
Jan 14, 2022
in
Sql
by
GeorgeBell
t-sql
0
votes
Q: what are dynamic queries in T-SQL?
asked
Dec 24, 2023
in
Sql
by
john ganales
t-sql
+2
votes
Q: Is it possible to import data directly from T-SQL commands without using SQL Server Integration Services? If so, what are the commands?
asked
Jan 15, 2022
in
Sql
by
GeorgeBell
t-sql
+2
votes
Q: What are types of XML indexes in SQL Server?
asked
Jan 15, 2022
in
Sql
by
GeorgeBell
t-sql
...