× 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.



I have a note that I made a while back from Birgitta Hauser. It has always worked for me. The trick is to make sure the number is CAST as DEC(8,0).

--NOTE:The numeric data value must be 8,0 in order for this to work.

--If necessary, cast the source value as DEC(8,0).

--Date(Digits(A.MyNum) concat '000000')

--Example:

SELECTA.MyNum

, Digits(A.MyNum) concat '000000'

, Date(Digits(A.MyNum) concat '000000') --**HERE IS THE CONVERSION**

FROM(SELECT Cast(20100310 as Dec(8, 0)) AS MyNum FROM sysibm.sysdummy1 ) A

Notice that the literal date, 20100310, was CAST as Dec(8,0) in the example above.When using numeric values directly (without decimal positions) these values are interpreted as being Integer and the Integer format consists of 10 digits instead of 8 which are expected.


Robert
"Contrariwise, if it was so, it might be; and if it were so, it would be; but as it isn't, it ain't. That's logic."--Tweedledee


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

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.