× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Everyone,

I've been using Java and JDBC code from Scott Klement and Jon Juracich
to retrieve data from an SQL Server table and it's been working fine
(thanks Scott & Jon!).

However, today it choked on a character representation of a numeric
value. Normal values coming from the SQL Server table look like this:

QUANTITY
4.0
0.0
0.39946459905712706
45.0
150.0

But today, one of the values was

1.1102230246251565E-16

I'm using the %dec() bif to convert these values to packed decimal, but
it doesn't handle character representations of floating point values.
I'm not even sure whether that's IEEE floating point or some other type.

The SQL statement I'm using is pretty simple:

SELECT Sku, Country, Period, Final_Fcst
FROM FCST_EXPORT
ORDER BY Country, Sku, Period

I tried changing it to

SELECT Sku, Country, Period, cast(Final_Fcst as dec(9,0))
FROM FCST_EXPORT
ORDER BY Country, Sku, Period

but that converted 6.211988930813584 to 3 and 1.1102230246251565E-16 to
0 (the latter might be right, but the former should be 6).

What am I doing wrong? A link to a good .pdf manual for SQL Server
would be welcome.

*Peter Dow* /
Dow Software Services, Inc.
909 793-9050
pdow@xxxxxxxxxxxxxxx <mailto:pdow@xxxxxxxxxxxxxxx> /








As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.