Decimal Format

  • I am trying to create a table and I have a field that needs to contain records similar to the following: 2.5, 3.125, 4.1275

    I tried making it a decimal format, but when I type "2.5", for example, SQL changes my entry to "2". I was under the impression that the decimal format was for entries with decimal points. Is this something that my SQL Administrator has changed or lockeddown, or is there some other modification that I am missing?

    In the meantime, I have setup the field as a float, but that is modifying the numbers. For example 3.4 is being changed in the output (Coldfusion page) to display as 3.3999999.

    Thanks in advance

  • How did you 'define' your decimal field? The proper syntax is:

    DECIMAL(p,s)

    p=precision - the number of digits total

    s=scale - number of digits to the right of the decimal.

    So, to be able to store your numbers

    2.5, 3.125, 4.1275

    you would need a decimal column as:

    DECIMAL(5,4)

    -SQLBill

  • Thanks SQLBill. The default scale was set to 0. I modified it and amazingly SQL keeps the decimal point. Stupid user error...gets you all the time.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply