Results 1 to 3 of 3

Thread: [RESOLVED] How do you store this number in the database.

  1. #1
    Join Date
    Jan 2010

    resolved [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.

  2. #2
    Join Date
    Aug 2004
    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.
    "Well done....Consciousness to sarcasm in five seconds!" ~ Terry Pratchett, Night Watch

    How to Ask Questions the Smart Way (not affiliated with this site, but well worth reading)

    My Blog
    cwrBlog: simple, no-database PHP blogging framework

  3. #3
    Join Date
    Oct 2010
    For what its worth, 0.025 comes back as 0.025 in SQL Server and MySQL:
    SQL Server Fiddle
    MySQL Fiddle
    www.rdennispallas.com <-- Personal Site, changing regularly cuz its ugly.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center