In the Stack Exchange Data Explorer, how come:
select sum(len(body)) from posts
works fine, but,select sum(len(text)) from comments
throws an error?
Arithmetic overflow error converting expression to data type int.
I experimented and discovered if I CAST..as BigInt
it will work (on either of the above queries), and that comparable field in the same table select sum(len(userdisplayname))
works fine with out conversion.
Posts.body nvarchar(max) 43,016,689,192 characters Works
Comments.Text nvarchar(600) 9,711,438,180 characters Errors
Comments.UserDisplayName nvarchar(30) 7,616,503 characters Works
T-SQL Int: ±4,294,967,295
T-SQL BigInt: ±9,223,372,036,854,775,807
Post.Body
is much larger, and Comments.UserDisplayName
is declared similarly as Comments.Text
, so I don't understand the difference.
Is this a SQL-thing or an SEDE-thing?