Re: number format to 2 decimals

Tech-Archive recommends: Fix windows errors by optimizing your registry



Thanks Buddy
that was very very ......helpful !!

ypul

"David Gugick" <david.gugick-nospam@xxxxxxxxx> wrote in message
news:e8NGR%23SnFHA.2860@xxxxxxxxxxxxxxxxxxxxxxx
> ypul wrote:
> > numericcolumn datatype is float
> >
> > ypul
> >
>
> Probably using the wrong data type. Why have you chosen to use an
> approximate data type like float/real instead of DECIMAL/NUMERIC which
> stores an exact represenation of a number? Do you really need to store.
> From BOL:
>
> "Approximate number data types for use with floating point numeric data.
> Floating point data is approximate; not all values in the data type
> range can be precisely represented."
>
> If you either must use a float or cannot change the data type to
> something more appropriate, you have two options:
> 1- Format the numeric data on the client - client formatting is
> preferred over using SQL Server to do the same
> 2- Use the CAST function, but you may have to deal with rounding issues
>
> For example:
>
> Declare @f real
> Set @f = .05
> Select @f -- Returns 5.5500001E-2
> Select CAST(@f as NUMERIC(10, 2)) -- Returns .06
>
>
> --
> David Gugick
> Quest Software
> www.imceda.com
> www.quest.com
>


.



Relevant Pages

  • Re: number format to 2 decimals
    ... > ypul wrote: ... >> select numericColumn from table1 ... > What data type are you using in the table? ...
    (microsoft.public.sqlserver.clients)
  • Re: Comparission cause problem
    ... >>Due to higher precision i would recommend to use the datatype double ... floating points then we should take the prefrence for the double data type. ... as you suggested that double will be faster as compared with the float. ... when it comes to comparing floating point types for equality you ...
    (alt.comp.lang.learn.c-cpp)
  • Best way to Import data from EXCEL using a TSQL
    ... FloatField - Float. ... This method gives me the following error message. ... "Error converting data type nvarchar to float." ... So i then change the data type in the table to VarChar on the Fload field ...
    (microsoft.public.sqlserver.datamining)
  • Best way to Import data from EXCEL using a TSQL
    ... FloatField - Float. ... This method gives me the following error message. ... "Error converting data type nvarchar to float." ... So i then change the data type in the table to VarChar on the Fload field ...
    (microsoft.public.sqlserver.server)
  • Re: Converting Reals into Floats
    ... the same data type family. ... float types in SQL Server derive from the internal format ... Real and float store values exactly ... Floats can store a wider range and precision than reals, ...
    (microsoft.public.sqlserver.server)