After some experimenting, I have now determined that the issue is not the number 200 per se, if
>= 200 is used, the error does not occur.
I cloned the rank and percentile query on data.SE and then replaced the 100 with 200 and got the following:
Error: Operand type clash: uniqueidentifier is incompatible with int
The strange part is that 199 and 201 both work fine, so there is some problem with the
> 200 in that query.
(For reference, this is the query which broke (it seems changing the UserId does not effect the outcome):
-- StackOverflow Rank and Percentile WITH Rankings AS ( SELECT Id, Ranking = ROW_NUMBER() OVER(ORDER BY Reputation DESC) FROM Users ) ,Counts AS ( SELECT Count = COUNT(*) FROM Users WHERE Reputation > 200 ) SELECT Id, Ranking, CAST(Ranking AS decimal(10, 5)) / (SELECT Count FROM Counts) AS Percentile FROM Rankings WHERE Id = ##UserId##
OS: Win 7 32 bit Browser: 14.0.835.202 m