Why is 199.96 – 0 = 200 in SQL?
I need to start by unwrapping this a bit so I can see what’s going on: SELECT 199.96 – ( 0.0 * FLOOR( CAST(1.0 AS DECIMAL(19, 4)) * CAST(199.96 AS DECIMAL(19, 4)) ) ) Now let’s see exactly what types SQLÂ Server is using for each side of the subtraction operation: SELECT SQL_VARIANT_PROPERTY (199.96 ,’BaseType’), SQL_VARIANT_PROPERTY … Read more