I came up with it this morning when I noticed your question, I'm glad it 
helped.  Just don't ask me how to make it work with negative numbers!




"Stone, Joel" <StoneJ@xxxxxxxxxxxxxxxx> 
Sent by: midrange-l-bounces+mkrouse=co.ottawa.mi.us@xxxxxxxxxxxx
04/26/2004 02:13 PM
Please respond to
Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>


To
"'Midrange Systems Technical Discussion'" <midrange-l@xxxxxxxxxxxx>
cc

Subject
RE: Query 400: can an alpha field be converted to numeric?






This is great.

Who came up with this novel approach?  It works great!!

Thanks!


-----Original Message-----
From: mkrouse@xxxxxxxxxxxxxxx [mailto:mkrouse@xxxxxxxxxxxxxxx]
Sent: Monday, April 26, 2004 8:58 AM
To: Midrange Systems Technical Discussion
Subject: Re: Query 400: can an alpha field be converted to numeric?


It's not pretty and I wonder about users being capable, but you can
convert them using the MICROSECOND function.  If the field is six digits
or less its fairly straightforward, if they're more than six or have
decimels it gets complicated quick.  The simplest would be a six character
field, no decimels, and would go like this where SIXCHAR is the input
character field and SIXDIGIT is the numeric result field.

DATETIME     '2004-01-01-01.00.00.' || SIXCHAR

SIXDIGIT        MICROSECOND(DATETIME)    6 0

If it has decimels you add another line to divide it by the appropriate
number.  If it's longer than six, you have to do it more than once and put
them together using numeric functions.






"Stone, Joel" <StoneJ@xxxxxxxxxxxxxxxx>
Sent by: midrange-l-bounces@xxxxxxxxxxxx
04/25/2004 11:44 AM
Please respond to
Midrange Systems Technical Discussion <midrange-l@xxxxxxxxxxxx>


To
"'Midrange Systems Technical Discussion'" <midrange-l@xxxxxxxxxxxx>
cc

Subject
Query 400: can an alpha field be converted to numeric?






Users want to convert an alpha field (containing all numeric characters)
to
a numeric field so they can do arithmetic operations.

Is there any way to do this in Query/400?

Any creative ideas how to do this?

Maybe using some of the date functions?

_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.

_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing 
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.
_______________________________________________
This is the Midrange Systems Technical Discussion (MIDRANGE-L) mailing 
list
To post a message email: MIDRANGE-L@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/mailman/listinfo/midrange-l
or email: MIDRANGE-L-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives
at http://archive.midrange.com/midrange-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

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.