Query Optimizer Deep Dive (AD)

preview_player
Показать описание
Paul White, SQL Kiwi Limited
Рекомендации по теме
Комментарии
Автор

Hi Paul, a follow up to your question in this video regarding Sum() on an empty set returning null and not 0... This also happens in C# programming but only for a list that you can query (known as an IQueryable). The sum of an empty IQueryable returns null. However, C# also has whats known as IEnumerable which is a list that you can enumerate over. The sum of an empty IEnumerable returns 0 which is what you'd expect. I'm sure the MS gods had some good reason to return null when the set is empty ;)

nicholassmith