Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 843075
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T06:04:00+00:00 2026-05-15T06:04:00+00:00

I am wondering what’s the best type for a price field in SQL Server

  • 0

I am wondering what’s the best type for a price field in SQL Server for a shop-like structure?

Looking at this overview we have data types called money, smallmoney, then we have decimal/numeric and lastly float and real.

Name, memory/disk-usage and value ranges:

  • Money: 8 bytes (values: -922,337,203,685,477.5808 to +922,337,203,685,477.5807)
  • Smallmoney: 4 bytes (values: -214,748.3648 to +214,748.3647)
  • Decimal: 9 [default, min. 5] bytes (values: -10^38 +1 to 10^38 -1 )
  • Float: 8 bytes (values: -1.79E+308 to 1.79E+308 )
  • Real: 4 bytes (values: -3.40E+38 to 3.40E+38 )

Is it really wise to store price values in those types? What about eg. INT?

  • Int: 4 bytes (values: -2,147,483,648 to 2,147,483,647)

Lets say a shop uses dollars, they have cents, but I don’t see prices being $49.2142342 so the use of a lot of decimals showing cents seems waste of SQL bandwidth. Secondly, most shops wouldn’t show any prices near 200.000.000 (not in normal web-shops at least, unless someone is trying to sell me a famous tower in Paris)

So why not go for an int?

An int is fast, its only 4 bytes and you can easily make decimals, by saving values in cents instead of dollars and then divide when you present the values.

The other approach would be to use smallmoney which is 4 bytes too, but this will require the math part of the CPU to do the calc, where as Int is integer power… on the downside you will need to divide every single outcome.

Are there any “currency” related problems with regional settings when using smallmoney/money fields? what will these transfer too in C#/.NET ?

Any pros/cons? Go for integer prices or smallmoney or some other?

What does your experience tell?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-15T06:04:01+00:00Added an answer on May 15, 2026 at 6:04 am

    If you’re absolutely sure your numbers will always stay within the range of smallmoney, use that and you can save a few bytes. Otherwise, I would use money. But remember, storage is cheap these days. The extra 4 bytes over 100 million records is still less than half a GB. As @marc_s points out, however, using smallmoney if you can will reduce the memory footprint of SQL server.

    Long story short, if you can get away with smallmoney, do. If you think you might go over the max, use money.

    But, do not use a floating-decimal type or you will get rounding issues and will start losing or gaining random cents, unless you deal with them properly.

    My argument against using int: Why reinvent the wheel by storing an int and then having to remember to divide by 100 (10000) to retrieve the value and multiply back when you go to store the value. My understanding is the money types use an int or long as the underlying storage type anyway.

    As far as the corresponding data type in .NET, it will be decimal (which will also avoid rounding issues in your C# code).

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

wondering how I can replace all special chars on my string like: hello this
Wondering if this is possible. We have an 3rd Party library that contains identification
Wondering what others do / best practice for communicating between layers. This question relates
Wondering if anyone out there has ran into this before.... I'd like to use
Wondering if you could help me with a simple SQL query. I have included
I have some data like this: 1 2 3 4 5 9 2 6
Wondering if I'm going about this the right way or not. I have 3
Wondering what is the best or most popular database client tool. Similar to Microsoft's
Wondering if I could get some advice and direction on this following requirement: Need
Wondering if it is at all possible. found: <script type=javascript> isSafari3 = false; if(window.devicePixelRatio)

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.