Jon_Walker
New User
Joined: 02 Jun 2008 Posts: 6 Location: Ottawa, Canada
|
|
|
|
Folks, I got a rookie problem with SQL. I have an SQL query with the following statement:
SUBSTR(DIGITS(b.SIN),2,9) where the SIN is an INTEGER field that I need to extract the 9 digits - hence the 2,9.
Problem is that the output from this has leading characters ".&" (quotes added for clarity).
.&114172661
The leading characters are the problem. I have knowledge of functions like CHAR() from my days working with SQL SERVER and RDBMS, JCL on the HP and VAX.
I was thinking about replacing the SUBSTR(DIGITS( functions with a CHAR statement like this: CHAR(b.SIN,2,9)
Would this solve the problem? Your sage advice and wisdom would be gratefully appreciated. Jon |
|
ashimer
Active Member
Joined: 13 Feb 2004 Posts: 551 Location: Bangalore
|
|
|
|
DIGITS function can take SMALLINT, INTEGER or DECIMAL as argument..
y dont you try SUBSTR(CHAR(b.SIN),3,9) to get the 9 digits after omitting ".&" ?? |
|