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

  • Home
  • SEARCH
  • 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 7488729
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T15:01:14+00:00 2026-05-29T15:01:14+00:00

I have a table with a current structure as follows: Currently this is populated

  • 0

I have a table with a current structure as follows:

enter image description here

Currently this is populated as follows:

enter image description here

The data stored for product value is a decimal value
and the end digits are cut off once it is inserted into the database.

I have tried changing the table structure as follows:

enter image description here

However this only leads to the following:

enter image description here

As you can see all values have a .00 appended if none exists, however I want to
store all these values with no decimal places. Except the product value.

How can I do this?

  • 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-29T15:01:16+00:00Added an answer on May 29, 2026 at 3:01 pm

    The trouble is you are converting a decimal (float / double) to an integer, so the value is simply truncated (decimal values are chopped off).

    If you really don’t want to use floats (decimal values) in the database you can use this hack work around will work:

    Multiply the number by 100 before inserting it, and then be sure to divide it by 100 when you use the data. This will allow you to maintain 2 decimal points while using integer storage.

    Thus, 2.4 would be stored as 240, 53 would be 5300, 20.74 becomes 2074 etc…

    I want to note that this is not an ideal solution, but rather a hack.

    I highly recommend what the other users suggested in the comments: storing the decimal value (as you have) and formatting it when presenting it.

    — In addition —

    Your real problem appears to be with the way the database is setup.

    Each of those values should have their own field since they will be repeated for each product.

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

Sidebar

Related Questions

I have a data Table with numbers formatted according to the current regional settings.
I have table with some fields that the value will be 1 0. This
The current structure is as follows: Table RowType: RowTypeID Table RowSubType: RowSubTypeID FK_RowTypeID Table
So I have this temp table that has structure like: col1 col2 col3 col3
I am currently implementing something quite similar to checkers. So, I have this table
I have a pretty standard table set-up in a current application using the .NET
I have a sqlite (v3) table with this column definition: timestamp DATETIME DEFAULT CURRENT_TIMESTAMP
I have an exchange rate table. I need to get current rate and previous
I have table rows of data in html being filled from a CGI application.
i have table structure with 3 colums (column1, column2, column3) and i want to

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.