Hi,
Can i store a percentage value as float or decimal? What is the difference?
What is the different b/w float and decimal type in sql server?
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
VulpesRank #55 · 29.2K reputationPosted Nov 3, 2011, 1:34 AM EDT
Pravin MoreRank #1,419 · 1.2K reputationPosted Nov 3, 2011, 1:57 AM EDT
Hi Nethra,
float data type is known as approximate data types.Approximate numeric data types do not store the exact values specified for many numbers they store an extremely close approximation of the value.do not use float when exact numeric behavior is required, such as in financial applications,
so decimal is perfect.
Thanks,
Pravin.
Nethra R SRank #6,347 · 269 reputationPosted Nov 3, 2011, 8:43 PM EDT
As you said i am saving percentage values and the datatype declared for that is decimal(3,2) but when a user enters 10.3 for example it gives an error saying cannot convert varchar to decimal
VulpesRank #55 · 29.2K reputationPosted Nov 4, 2011, 2:04 AM EDT
If you do, how are you making the conversion?