You cannot doREPLACE(MyColumn, 'SomeString', NULL)the final parameter has to be a string.If PENDING is the exact value then this would workSELECT CAST( REPLACE( Nullif(Problem16, 'PENDING') ,'$','') as DECIMAL(10,2))FROM @temp
If there are several other values that you need to NULLify then I suspect this would be more efficientSELECT CASE WHEN Problem16 = 'PENDING' THEN NULL WHEN Problem16 LIKE '%GOOFY%' THEN NULL ELSE CAST(REPLACE(Problem16, '$','') as DECIMAL(10,2)) ENDFROM @temp
lastly your IsNull() in your WHERE clause is doing:WHERE IsNull(SomeDecimal_10_2, SomeString)
IsNull() has some strange behaviours when you mix datatypes (for that reason we always use COALESCE() instead of IsNull() - added benefit is that COALESCE() can take 2, or more, parameters - and returns the first one that is non-NULL)At the least doWHERE IsNull(... Your Decimal Expression ..., 0.0)
so that the types match. But personally I would still use COALESCE() instead of IsNull()