Using IBM i? Need to create Excel, CSV, HTML, JSON, PDF, SPOOL reports? Learn more about the fastest and least expensive tool for the job: SQL iQuery.
Anybody know how to return two integers in an sql statement, preserving any leading zeros in the second integer?
So if the fields are 1,0 and 4,0 respectively, and the values are
1 and 0002
I can select concat(firstfield, secondfield) (or '||', if you prefer), and get
10002.
DIGITS function will do it.
SELECT CONCAT(DIGITS(firstfield), DIGITS(secondfield))
It uses absolute value of the number, so if your values can ever be negative, you'll want some sort of CASE to deal with the sign.