Re: Decimal Data Type, is rounding....ah!

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance

From: Zach Wells (no_zwells_spam_at_ain1.com)
Date: 06/02/04


Date: Wed, 02 Jun 2004 16:52:07 -0500

mitchel wrote:

> Hi,
>
> I am submitting the following number to my SQL table to a field with a
> Decimal Data Type:
>
> 1.5873015873
>
> But when I bring back the number via ASP or check it in Enterprise Manager
> it records: 2
>
> These are the settings for the field:
>
> Decimal
> Description: blank
> Default Value: (0)
> Precision: 12
> Scale: 0
> Identity: No
>
> Should I be using a different data type? I will be doing some averaging
> with these numbers later on so that it why I selected Decimal.
>
> Thanks!
>
> Mitch
>
>
>

Scale = number of decimal places to the right of the decimal, you have
it at 0. Check out decimal/numeric in books online for a more thorough
explanation.

Zach



Relevant Pages

  • Re: syntax to add decimal column to access table using SQL?
    ... set the data type in SQL to numeric and the precision value to 10 and then ... the scale value to 3 ...
    (microsoft.public.access.gettingstarted)
  • Re: very new to sql
    ... For some reason when the value gets stored into the SQL ... The data type is saved as decimal. ... > Precision specifies the total number of digits both on the left and right ... > the result will be truncated at the defined scale... ...
    (microsoft.public.sqlserver.msde)
  • Re: Decimal Data Type, is rounding....ah!
    ... Mitch ... > I am submitting the following number to my SQL table to a field with a ... > Should I be using a different data type? ...
    (microsoft.public.sqlserver.programming)
  • Decimal Data Type, is rounding....ah!
    ... I am submitting the following number to my SQL table to a field with a ... Should I be using a different data type? ... Mitch ...
    (microsoft.public.sqlserver.programming)
  • Re: Decimal Data Type, is rounding....ah!
    ... >I am submitting the following number to my SQL table to a field with a ... >But when I bring back the number via ASP or check it in Enterprise Manager ... >Should I be using a different data type? ...
    (microsoft.public.sqlserver.programming)