|
I stand corrected. It has been a while. Al Al Barsa, Jr. Barsa Consulting Group, LLC 400>390 914-251-1234 914-251-9406 fax http://www.barsaconsulting.com http://www.taatool.com "Alex Moore" <alexm@ellishosie ry.com> To Sent by: "'Midrange Systems Technical midrange-l-bounce Discussion'" s@xxxxxxxxxxxx <midrange-l@xxxxxxxxxxxx> cc 04/25/2004 01:09 Subject PM RE: Query 400: can an alpha field be converted to numeric? Please respond to Midrange Systems Technical Discussion <midrange-l@midra nge.com> I believe digits converts numeric values to alpha.....however This is from Ted Holt on Midrange Server: I think SQL is a good way to go. Query/400 can read SQL views in the same way it reads logical files. The following SQL command creates a view that defines the alpha field amount as a nine-digit packed-decimal field with two decimal positions: create view myview as select key, dec(amount,9,2) as amt from mydata The following SQL commands convert alpha fields to numeric values: select real(amount) from mydata select double(amount) from mydata select int(month) from mydata select cast (amount as double) from mydata Not only is this good for Query, you could use SQL statements like these in RPG programs. -- Ted Alex It's been a long time, but look for the "digits" function in Query. Al Al Barsa, Jr. Barsa Consulting Group, LLC 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.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.