August 6, 2010 at 9:32 pm
I run Update query to a Float field from a table with specific decimal value like "1.25".
But the value enter as like "1.2450029" after updating finish.
How can I do to get specific decimal value to update exact value?
Any help is welcomed and appreciated ... 🙂
August 6, 2010 at 11:37 pm
That's the problem with float data type, it's just an approximation. If you want 1.25, then use decimal data type.
Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
Ramblings of a DBA (My SQL Server Blog)[/url]
Subscribe to my blog
August 6, 2010 at 11:43 pm
Use the ROUND Function - for help & examples, refer BOL.
Thanks & Regards,
Nakul Vachhrajani.
http://nakulvachhrajani.com
Follow me on
Twitter: @sqltwins
August 6, 2010 at 11:45 pm
Thanks for your kindly help brother.
But in this case, I can't change data type of those fields. I'm not allowed to change the properties of table.
Is there other ways to solve the problem.
Best Regards .....
August 6, 2010 at 11:59 pm
Nakul Vachhrajani (8/6/2010)
Use the ROUND Function - for help & examples, refer BOL.
The problem is with how it's stored.
Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
Ramblings of a DBA (My SQL Server Blog)[/url]
Subscribe to my blog
August 7, 2010 at 12:38 am
Thanks to all brothers ...
I can solve the problem with all your suggestions.
by adding round function at Update Query like ....
UPDATE Products
SET ProductWeight = ROUND(@ProductWeight, 6)
Wishing you the best of everything ..... 🙂
August 7, 2010 at 12:41 am
I realize that ROUND has solved your immediate issue, however make sure you understand the float data type.
Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
Ramblings of a DBA (My SQL Server Blog)[/url]
Subscribe to my blog
August 7, 2010 at 1:16 am
Yes brother ... I will
August 9, 2010 at 10:31 pm
Yes .... I am just a beginner in Database. Thanks a lot for guiding me ..... 🙂
Viewing 9 posts - 1 through 8 (of 8 total)
You must be logged in to reply to this topic. Login to reply