Solved

how can i convert a numeric field to a character field using as400 query

Posted on 2008-10-26
3
1,201 Views
Last Modified: 2013-12-06
I would like to know how to convert an numeric field to a character fiels using AS400 Query on an i5 OS
0
Comment
Question by:louva
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
3 Comments
 
LVL 12

Expert Comment

by:jazzIIIlove
ID: 22808026
Hi there;

You have to use the DIGITS function to convert numeric to character first.
Then you can use SUBSTR if you like...

substr(digits(blabla, 2, 3))

Best regards...
0
 
LVL 12

Accepted Solution

by:
jazzIIIlove earned 500 total points
ID: 22808033
Of course:

You can't substring numerics. Convert it to a character first; then substring that result.

Best regards...

0
 
LVL 18

Expert Comment

by:daveslash
ID: 22813247

If you're using SQL (which is generally WAY easier and more powerful), then you can simply use the CHAR or VARCHAR functions.

e.g.

select char(aNumeric)
from   deleteme
;
 
HTH,
DaveSlash

Open in new window

0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

CCModeler offers a way to enter basic information like entities, attributes and relationships and export them as yEd or erviz diagram. It also can import existing Access or SQL Server tables with relationships.
Azure Functions is a solution for easily running small pieces of code, or "functions," in the cloud. This article shows how to create one of these functions to write directly to Azure Table Storage.
Video by: Steve
Using examples as well as descriptions, step through each of the common simple join types, explaining differences in syntax, differences in expected outputs and showing how the queries run along with the actual outputs based upon a simple set of dem…
Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

730 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question