I understand float is stored as binary and is a representation in SQL Server. However, I need the max number of decimal places that are represented in a float column in my table. I found this link which explains how to get the number of decimal places per row. However, I can't figure out how to get the max for that result. In essence this is what I want to do.
SELECT MAX
(Decimals = CASE Charindex('.', [QUANTITY])
WHEN 0 THEN 0
ELSE
Len (Cast(Cast(Reverse(CONVERT(VARCHAR(50), [QUANTITY], 128)
) AS FLOAT) AS BIGINT))
END)
FROM [schema].[table]
This gives me a syntax error after the END. I have tried a sub query and can't seem to get the syntax correct either.