Can Count(*) ever return null? [duplicate]
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.
精彩评论