I have a table with datafields in real datatype. Do you lose precision when converting to money or decimal datatype?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
That depends on the precision and scale that you have specified for the decimal type. If you for example have a
decimal(19,2)and try to convert therealnumber1.123, you will get the value1.12.The
decimaltype has higher precision than therealtype, so it’s capable of handling anyrealvalue that is within it’s range without loosing precision.The
moneytype can hold the same data as a decimal(19,4).The
decimalandmoneytypes are exact types, whilerealis an approximate type. If you convert arealto adecimalyou may see a value that is not exactly what you see in therealvalue, but that is because therealvalue is rounded when it’s displayed and thedecimalvalue is not.