|
Use this on 6-char substrings, then multiply by 1,000,000 as appropriate. This is one good reason to go to SQL, using QM queries and forms. There are even some nifty formatting options in QM forms. Some of the summary vs detail stuff is harder, in QM, however. At 03:11 PM 4/2/02 -0500, you wrote: >Found this in the archives (posted by douglas handy) searched on >microsecond >********************************************************************* >I only know of one kludge, but it only handles character fields up to >6 digits long AND it must have leading zeros. > >The trick is to use the MICROSECOND( timestamp ) function to extract >the numeric value of the last 6 bytes in a 26-byte timestamp. The >idea is to concatenate a constant for the date/time portion with the >character field to create a timestamp, then let MICROSECOND( ) return >the numeric value of the portion you concatenated. > >For example, if you have a character field containing 5 digits: > > NUM = MICROSECOND( '0001-01-01-00.00.00.0' || field ) > >or if you have a 3-digit character field: > > NUM = MICROSECOND( '0001-01-01-00.00.00.000' || field ) > >This has limited application, because you must know the number of >bytes and it must have leading zeros. If it has leading blanks, the >timestamp expression becomes invalid and it returns 0. If it has >trailing blanks, the blanks are treated as zeros. EG, in the first >example above if the field contained '123 ' then NUM = 12300. > >Like I said, it is a kludge with limited application. But it does >help in a few cases. > >Doug >************************************************************************ >*** >Mark Allen >I.S. Manager >Wilkes Telephone & Electric >A Dycom Company >Phone: (706) 678-9565 >Email: allenmark@nu-z.net >http://www.nu-z.net > > > > >:-----Original Message----- >:From: midrange-l-admin@midrange.com >:[mailto:midrange-l-admin@midrange.com] On Behalf Of Dan Bale >:Sent: Tuesday, April 02, 2002 3:01 PM >:To: midrange-l@midrange.com >:Subject: RE: Converting alpha to numeric in Query >: >: >:Wrong way. That converts a numeric to alpha. Albert wants >:the other way. AFAIK, can't be done. >: >:- Dan Bale >:(I am *NOT* "Dale" >:http://archive.midrange.com/midrange-:l/200105/msg00281.html ) >:SAMSA, Inc. 989-790-0507 >:DBale@SAMSA.com <mailto:DBale@SAMSA.com> >: Quiquid latine dictum sit altum viditur. >: (Whatever is said in Latin seems profound.) >: >:-----Original Message----- >:From: midrange-l-admin@midrange.com >:[mailto:midrange-l-admin@midrange.com]On Behalf :Of J Michael >:Smith >:Sent: Tuesday, April 02, 2002 2:52 PM >:To: 'midrange-l@midrange.com' >:Subject: RE: Converting alpha to numeric in Query >: >: >:%DIGITS(VALUE) >: >:Michael Smith >: >:-----Original Message----- >:From: York, Albert [mailto:albert.york@nissan-usa.com] >:Sent: April 02, 2002 01:32 PM >:To: 'MIDRANGE-L@midrange.com' >:Subject: Converting alpha to numeric in Query >: >: >:Is there a way in Query to convert in alpha field to a numeric >:field. The field will always contain valid digits. >: >:Albert York >: >:_______________________________________________ >:This is the Midrange Systems Technical Discussion (MIDRANGE-L) >:mailing list To post a message email: MIDRANGE-L@midrange.com >:To subscribe, unsubscribe, or change list options, >:visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l >:or email: MIDRANGE-L-request@midrange.com >: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@midrange.com >To subscribe, unsubscribe, or change list options, >visit: http://lists.midrange.com/cgi-bin/listinfo/midrange-l >or email: MIDRANGE-L-request@midrange.com >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 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.