In the SELECT statement, I am trying to calculate a percentage with a precision of 1 decimal place.
This statement in the select statement returns an arithmetic overflow error:
CAST(((COUNT(TicketNbr)*100.00)/@TotalCount) AS Decimal (3,1)) END AS Percentage
The COUNT(TicketNbr) count value is 10.
The @TotalCount value is 10.
If I do not cast the result, the result is 1.0000. But when I use the CAST function, the query results an arithmetic overflow error.
Why does this error occur?