Login
Remember
Register
Ask a Question
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.
...