Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Database & SysAdmin
  3. Database
  4. SQL Server 7.0 SP3 and money datatype

SQL Server 7.0 SP3 and money datatype

Scheduled Pinned Locked Moved Database
databasesql-servercomsysadminquestion
3 Posts 2 Posters 5 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • L Offline
    L Offline
    Lost User
    wrote on last edited by
    #1

    I have built a database that has some tables that use the money datatype. The pain in the arse in when I retrieve the data using SQL it always returns 4 decimal places. Is there some way that I force SQL Server to only store 2 decimal places? Or is the something I can do in the SQL statement to truncate/round it to 2 decimal places? Either will do as I only store 2 decimal places worth of value in there anyway. Michael Martin Pegasystems Pty Ltd Australia martm@pegasystems.com +61 413-004-018 "Don't belong. Never join. Think for yourself. Peace" - Victor Stone

    W 1 Reply Last reply
    0
    • L Lost User

      I have built a database that has some tables that use the money datatype. The pain in the arse in when I retrieve the data using SQL it always returns 4 decimal places. Is there some way that I force SQL Server to only store 2 decimal places? Or is the something I can do in the SQL statement to truncate/round it to 2 decimal places? Either will do as I only store 2 decimal places worth of value in there anyway. Michael Martin Pegasystems Pty Ltd Australia martm@pegasystems.com +61 413-004-018 "Don't belong. Never join. Think for yourself. Peace" - Victor Stone

      W Offline
      W Offline
      Wanderley M
      wrote on last edited by
      #2

      Hi Is there a specific reason to use money? You could use numeric instead of money - this way you can define how many decimal places you need. Do you need to make calculations after you retrieve the data? If not, you could use SELECT STR(, 8, 2) FROM [...] HTH Regards, Wanderley

      L 1 Reply Last reply
      0
      • W Wanderley M

        Hi Is there a specific reason to use money? You could use numeric instead of money - this way you can define how many decimal places you need. Do you need to make calculations after you retrieve the data? If not, you could use SELECT STR(, 8, 2) FROM [...] HTH Regards, Wanderley

        L Offline
        L Offline
        Lost User
        wrote on last edited by
        #3

        Wanderley thanks for the information looks like what I need. There isn't any reason to use money other than I was lazy, saw it and used it. I will try it as numeric, otherwise I will use the SELECT trick. :-D Michael Martin Pegasystems Pty Ltd Australia martm@pegasystems.com +61 413-004-018 "Don't belong. Never join. Think for yourself. Peace" - Victor Stone

        1 Reply Last reply
        0
        Reply
        • Reply as topic
        Log in to reply
        • Oldest to Newest
        • Newest to Oldest
        • Most Votes


        • Login

        • Don't have an account? Register

        • Login or register to search.
        • First post
          Last post
        0
        • Categories
        • Recent
        • Tags
        • Popular
        • World
        • Users
        • Groups