I have this query....
SELECT
CONVERT(NUMERIC(8, 2), ResultLevel),
*
FROM
dbo.DrugTestResult
WHERE
DrugID = 'THC'
AND ISNUMERIC(ResultLevel) = 1
AND (CONVERT(NUMERIC(8, 2), ResultLevel) >= 50
AND CONVERT(NUMERIC(8, 2), ResultLevel) <= 99999)
AND CONVERT(DATE, AuditStamp) > '2014-1-1'
Which returns this error
Arithmetic overflow error converting varchar to data type numeric
When I comment this part of the where clause
AND ( CONVERT(NUMERIC(8, 2), ResultLevel) >= 50
AND CONVERT(NUMERIC(8, 2), ResultLevel) <= 99999
)
The data set is returned.
So the question is why does the CONVERT work in the SELECT, but not in the WHERE clause?