Float display within SQL Server conversion decimal numeric

  • When loading data into SQL Server through SAS DI trying to figure out the behavior regarding a data type.

    I chose a float(53) datatype on SQL Server end because numeric and decimal kept bombing from the ETL tool.

    Actual Value: 31634656.465248801

    Database Displayed Value: 31634656.4652488 Query Results

    When querying the actual value '31634656.465248801' the results is 31634656.4652488

    Can this be converted so the whole value is displayed?

    Regards,

    Jonathan

  • You might be able to in the case of that exact value, by casting it as an appropriate numeric type. However, that is not a reliable technique. For example:

    DECLARE @a float(53)=31634656.465248801

    SELECT CAST(@a as decimal(20,10))

    SET @a=31634656.4652488039

    SELECT CAST(@a as decimal(20,10))

    As pointed out at https://msdn.microsoft.com/en-us/library/ms173773.aspx, the precision of float(53) is only 15 digits. That number is 17 digits. If you need to preserve that exact value, you'll need to find a way to make decimal/numeric work with your process.

    Cheers!

Viewing 2 posts - 1 through 1 (of 1 total)

You must be logged in to reply to this topic. Login to reply