Hugo Kornelis (5/8/2012)
Wow, did a google search and there was no mention in any of the four posts I checked about the count_big so I got it wrong.
You would have found it if you checked Books Online: http://msdn.microsoft.com/en-us/library/ms191432.aspx
. We all like to bash BOL when we find something missing or a documentation error, but in reality I still think SQL Server is one of the best documented programs on the market.
Agreed. AND BOL does have space for comments, so if it IS incorrect, we have the ability to fix it, rather than just complaining.
EDIT: Forgot to add: Nice question, but the code was a bit hard to read. May I suggest that the next time someone uses a screenshot for the question instead of just providing the code, he or she first increases the font size?
Agreed. They could also either 1) use PNG instead of JPG, or 2) increase the JPG quality setting of their screenshot app so there's not so much lossy compression.
The question itself was quite good, and the link provided in the explanation really does provide a good explanation of why this happens. (Essentially, SQL Server requires COUNT_BIG() on indexed views to prevent a potential overflow for tables with large numbers of rows.)
I got the question right because the existence of the question implied there was an issue, learned about the issue, and got a chance to comment! Win-win-win!