Press "Enter" to skip to content

Fun With Implicit Conversions

Bert Wagner takes us through some cases where the data type makes your floating point division results quite different:

Let’s start with this example:
SELECT 4.4/CAST(.44 AS VARCHAR(5))

Ignoring for a moment that our denominator is of type VARCHAR, if we do some quick mental math or use a calculator, we can see that the answer should be 10:

Spoilers: it isn’t 10, and Bert explains why.