Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

T-SQL: What does this passage in the COALESCE documentation mean?

ISNULL and COALESCE though equivalent, can behave differently. An expression involving ISNULL with non-null parameters is considered to be NOT NULL, while expressions involving COALESCE with non-null parameters is considered to be NULL.

http://msdn.microsoft.com/en-us/library/ms190349.aspx

like image 442
Jonathan Allen Avatar asked Feb 25 '23 12:02

Jonathan Allen


1 Answers

It determines the nullability of, say, a computed column using ISNULL or COALESCE

RowCheckSum AS COALESCE(...)

...means that RowCheckSum column definition has NULL keyword, and

RowCheckSum2 AS ISNULL(...)

...has NOT NULL definition.

This also means, that in result set first field can return NULL values, and second - cannot.

like image 176
zerkms Avatar answered Feb 28 '23 03:02

zerkms