Jump to content
jimfog

storing prices

Recommended Posts

What do you think is the best column type for storing prices?

Share this post


Link to post
Share on other sites

What kind of question is that?!

 

It depends, how big your price value could be.

 

Use float, in that case, you will be able to hold price value with cents.

Share this post


Link to post
Share on other sites

for storing currency best to use decimal. float has issues to loss data in arithmetic operation.

Share this post


Link to post
Share on other sites

What kind of question is that?!

 

that's a perfectly legitimate question. No need to be condescending.

 

I also agree with birbal, I use decimal to store currency values. usually something like (10,2), but should be changed to best reflect the requirements of your application.

Share this post


Link to post
Share on other sites

that's a perfectly legitimate question. No need to be condescending.

 

I TOTALLY AGREE...THANKS

Share this post


Link to post
Share on other sites

Ι used decimal(3.2) but I noticed that it cannot accept 10 or 20 for example....why that? I thought the 3 means 3 digit number MAX.

 

I receive a message saying out of range value....

Share this post


Link to post
Share on other sites

First param is total digits including integer part and fraction part. Second one is number of fraction part.So (3,2) can be max to 9.99

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

×
×
  • Create New...