2012年3月27日星期二

FLOAT

I want to use only float datatype but the problem is that it return more
than two decimal, I want to minimize to two decimal points? I don't want to
use decimal datatype... I only wanna use float....
The result should looks like
152254.45
but now it's giving me.
152254.45123232363
Any solution ?
Thanks
On Wed, 2 Nov 2005 11:19:15 -0500, Rogers wrote:

>I want to use only float datatype but the problem is that it return more
>than two decimal, I want to minimize to two decimal points? I don't want to
>use decimal datatype... I only wanna use float....
>The result should looks like
>152254.45
>but now it's giving me.
>152254.45123232363
>Any solution ?
Hi Rogers,
No, of course not. The FLOAT datatype is designed to *not* have an exact
and limited number of decimals. The datatypes that are designed to offer
a fixed number of decimal places are decimal and numeric.
Saying "I want to have two decimal points but I don't want to use
decimal datatype... I olnly wanna use float" is like saying "I want to
travel by air but I don't want to use a plane... I only wanna use a
boat".
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
|||I only want to use float datatype because I have to frequenly convert the
database into Access 97 and Access doesn't support decimal and numeric
datatype.
Thanks
"Hugo Kornelis" <hugo@.pe_NO_rFact.in_SPAM_fo> wrote in message
news:q43im1ddb79j8bmre6kugqrjo7nem75f6r@.4ax.com...
> On Wed, 2 Nov 2005 11:19:15 -0500, Rogers wrote:
>
> Hi Rogers,
> No, of course not. The FLOAT datatype is designed to *not* have an exact
> and limited number of decimals. The datatypes that are designed to offer
> a fixed number of decimal places are decimal and numeric.
> Saying "I want to have two decimal points but I don't want to use
> decimal datatype... I olnly wanna use float" is like saying "I want to
> travel by air but I don't want to use a plane... I only wanna use a
> boat".
> Best, Hugo
> --
> (Remove _NO_ and _SPAM_ to get my e-mail address)
|||Rogers wrote:
> I only want to use float datatype because I have to frequenly convert
> the database into Access 97 and Access doesn't support decimal and
> numeric datatype.
>
Access 2003 ( I realize this is not Access 97 - but that version is almost 9
years old) has a Number Data Type, which can then be qualified with the
"Number" type. Choice abound:
- Byte
- Integer
- Long Integer
- Single
- Double
- Replication ID
- Decimal - which has precision and scale to match that used by SQL Server
David Gugick
Quest Software
|||On Wed, 2 Nov 2005 14:47:07 -0500, Rogers wrote:

>I only want to use float datatype because I have to frequenly convert the
>database into Access 97 and Access doesn't support decimal and numeric
>datatype.
Hi Rogers,
I just did a quick test - create a table with a decimal(9,2) column in
SQL Server, then create a linked table in Access 97. Access defines the
column as double. I could enter and retrieve data without any problems
(other than data with more than two decimals being rounded).
Best, Hugo
(Remove _NO_ and _SPAM_ to get my e-mail address)
sql

没有评论:

发表评论