mssql -- 소수점이하 정확한 값은 decimal 사용하라
mssql -- 소수점이하 정확한 값은 decimal 사용하라.
참고 : https://msdn.microsoft.com/en-us/library/ms187912(v=sql.105).aspx
** Decimal, Numeric 은 동의어, 서로 대체가능함.
The decimal data type stores an exact representation of the number; there is no approximation of the stored value.
--> decimal 은 정확한 값을 저장함. 근사값 아님.
Use the decimal data type to store numbers with decimals when the data values must be stored exactly as specified.
-->소수점이하 정확한 값을 저장할때는 decimal 사용하라.
The float and real data types are known as approximate data types.
--> float, real 은 근사값이다.
Avoid using float or real columns in WHERE clause search conditions, especially the = and <> operators. It is best to limit float and real columns to > or < comparisons.
--> 값을 비교할때는 float, real 사용하지 마라!
<< 참고 사항 >>
https://msdn.microsoft.com/en-us/library/ms190476(v=sql.110).aspx
https://msdn.microsoft.com/en-us/library/ms187746(v=sql.110).aspx
** decimal data type
decimal [ (p[ ,s] )]
123.45 ==> precision = 5, scale = 2