You must Sign In to post a response.
  • Category: SQL Server

    Which datatype is used for storing amount in sql server

    hi,
    i am developing one application where i want to store amount in database ,for that i used datatype float but amount is stored in such as 447.27999877929688 i want only stored 447.27 when what should i do can i change datatype or format of current datatype;
  • #724257
    Hi abhijit,

    for storing salaray information better to use money datatype. This will give you your desired output.

    --------------------------------------------------------------------------------
    Give respect to your work, Instead of trying to impress your boss.

    N@veen
    Blog : http://naveens-dotnet.blogspot.in/

  • #724259
    thnaks sir,but can i use money data type in my stored procedure

  • #724261
    Hello Abhijit,

    As suggested money is the best data type and to use it in the stored procedure while calling or passing from front end use decimal.

    So finally the column in the database will be money and in front end pass it as decimal.

    Regard's
    Raj.Trivedi
    "Sharing is Caring"

  • #724262
    thnaks sir

  • #724278
    In my project we have used decimal(19,2).I would recommed you do try the same.
    Regards
    Rakesh Chaubey
    rakeshchaubey1989@gmail.com

  • #724280
    ya sir ,i dont use money but use decimal (18,2).it work nice ,thanks sir

  • #724295
    Hi,

    Money is the ideal one but you have many options like decimal, float etc.

    The MONEY type has 4 decimal places if you are looking for more accuracy then you can probably go for decimal.


    Regards,
    Asheej T K

  • #724372
    hi,
    My suggestion is use decimal(15,2) to store amount values.

    Regards
    N.Ravindran
    Your Hard work never fails

  • #724380
    we can use money and smallmoney data type in SQL Server for storing monetary data.Which are given with range and storage capacity

    [1]Data type : Money

    Range Storage :-922,337,203,685,477.5808 to 922,337,203,685,477.5807

    Storage :8 bytes

    [2] Data type :smallmoney

    Range Storage :- 214,748.3648 to 214,748.3647

    Storage : 4 bytes

    You can also use other options exception Money like decimal, float etc.

  • #724427
    Hi

    You ca use money datatype for fields like employee salary, and amount kind of things. For students marks kind of things use decimal or float. the choice is yours. you can make use of any of these data types

    Regards,
    Ranadheer

  • #724590
    Hi.

    you can use decimal(18,2) data type to store the amount values.

    Regards,
    Mani

  • #730263
    Hi,




    You Can use money DataType the range will be


    money -922,337,203,685,477.508 to 922,337,203685,477.5807 8 bytes


    smallmoney -214,748.3648 to 214,748.3647 4 bytes


    Hope this will help


    Sriram.R


  • This thread is locked for new responses. Please post your comments and questions as a separate thread.
    If required, refer to the URL of this page in your new post.