开发者

Can Count(*) ever return null? [duplicate]

开发者 https://www.devze.com 2023-02-10 03:39 出处:网络
This开发者_如何学JAVA question already has answers here: Closed 11 years ago. Possible Duplicate:
This开发者_如何学JAVA question already has answers here: Closed 11 years ago.

Possible Duplicate:

Does COUNT(*) always return a result?

Is it possible in any scenario for the Count() function to return NULL?


No, it will only return a zero (or non-zero) result. SqlServer will not return null.


According to the MSDN page, no.

That said:

For return values greater than 2^31-1, COUNT produces an error. Use COUNT_BIG instead.


No.

This will be 0

select count(*)
where 0=1

This will be 1

select count(*)


No it returns a zero if the table does not have any records in the table


No. If the table or specific field being counted are empty it will return zero.

0

精彩评论

暂无评论...
验证码 换一张
取 消