+ Reply to Thread
Results 1 to 3 of 3

Thread: money datatype problem

  1. #1
    Barn Loyal todd2006 is an unknown quantity at this point todd2006's Avatar
    Join Date
    Mar 2008
    Posts
    889
    Rep Power
    4

    money datatype problem

    Hello,

    this is my asp code where I add a amount to the price field

    p.Append cm.CreateParameter("@Price",adCurrency,1,2)
    cm("@Price") = price


    In my stored procedure I have it like this

    @Price Money,

    the data type of price field in sql is money

    but when I see the data in table it looks like this

    150.0000

    when it should be $150.00

    Can someone tell me why its not adding in the currency format into the table

  2. #2
    The Barnfather jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead has much to be proud of jmurrayhead's Avatar
    Join Date
    Mar 2008
    Location
    Reston, VA
    Posts
    4,547
    Blog Entries
    9
    Real Name
    Jason
    Rep Power
    22

    The Money data type stores data in 8 bytes. The 4 decimal places are used for accuracy. You need not worry that it stores it as 150.0000.
    jmurrayhead
    If you agree, give me rep.
    If you like it here...throw us a few bones to help support us.


  3. #3
    Wolfmaster Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy is a splendid one to behold Wolffy's Avatar
    Join Date
    Mar 2008
    Location
    Peoria, IL
    Posts
    2,386
    Blog Entries
    5
    Real Name
    Wolff
    Rep Power
    15

    The money type is used to contain a precise non-integer number , while real and float can only approximate a value. Actual formatting of the output is up to you. After all, if you were doing a application that included gallons of gas, you'd need the extra digits (i.e. 2.199 as of today).
    Wolffy
    .-- ----- ..-. ..-. -.--
    Opinions expressed are my own and do not necessity reflect those of any sane person. Any code provided is intended to be an example and is provided AS IS. Void where prohibited by law. Not valid in California. Your mileage may vary.

+ Reply to Thread

Similar Threads

  1. SQL Money Query Error
    By todd2006 in forum SQL Development
    Replies: 1
    Last Post: October 8th, 2008, 10:25 PM

Bookmarks

Posting Permissions

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

SEO by vBSEO