[RESOLVED] How do you store this number in the database.
For all people good with numbers, Im not very good with numbers and i cant seem to store this number in the database, 0.025, it always gets round up to 0.030, what can i do, can you explain me what it means. its for storing money. Im using decimal(4, 3)
Thanks very much, i really need help
Last edited by juanlr; 04-11-2013 at 12:54 AM.
As far as I know, that should be okay, but remember that the "4" in the type definition is the number of significant digits (not just the number of digits to the left of the decimal), so rounding may occur with a value like 12.025, which would require 5 significant digits to avoid any rounding. But in this specific circumstance, I'd be more suspicious of the application code for now, until proven otherwise.
"Please give us a simple answer, so that we don't have to think, because if we think, we might find answers that don't fit the way we want the world to be."
~ Terry Pratchett in Nation
For what its worth, 0.025 comes back as 0.025 in SQL Server and MySQL:
SQL Server Fiddle
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)