?
Solved

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

Posted on 2008-10-26
3
Medium Priority
?
1,206 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 2000 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:Dave Ford
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

Are You Using the Best Web Development Editor?

The worlds of web hosting and web development are constantly evolving. Every year we see design trends change, coding standards adapt and new frameworks/CMS created. With such a quick pace of change it’s easy to get lost trying to keep up.

See if your editor made the list.

Question has a verified solution.

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

A company’s centralized system that manages user data, security, and distributed resources is often a focus of criminal attention. Active Directory (AD) is no exception. In truth, it’s even more likely to be targeted due to the number of companies …
This post looks at MongoDB and MySQL, and covers high-level MongoDB strengths, weaknesses, features, and uses from the perspective of an SQL user.
This is a high-level webinar that covers the history of enterprise open source database use. It addresses both the advantages companies see in using open source database technologies, as well as the fears and reservations they might have. In this…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…

777 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