Difference between numeric, float and decimal in SQL Server

后端 未结 8 1292
半阙折子戏
半阙折子戏 2020-11-22 04:27

What are the differences between numeric, float and decimal datatypes and which should be used in which situations?

For any ki

8条回答
  •  广开言路
    2020-11-22 05:29

    Decimal has a fixed precision while float has variable precision.

    EDIT (failed to read entire question): Float(53) (aka real) is a double-precision (64-bit) floating point number in SQL Server. Regular Float is a single-precision (32-bit) floating point number. Double is a good combination of precision and simplicty for a lot of calculations. You can create a very high precision number with decimal -- up to 136-bit -- but you also have to be careful that you define your precision and scale correctly so that it can contain all your intermediate calculations to the necessary number of digits.

提交回复
热议问题