|
|
Archives of the TeradataForum
Message Posted: Fri, 02 Jul 2004 @ 16:40:34 GMT
Subj: | | Re: Substr question |
|
From: | | Babu, Mahesh |
I don't think you can use a -ve number as outbounds. You can use the following SQL to SUBSTR backward.
select
characters(trim('265CPI0')) Chrs,
'265CPI0' Strng,
1 offset,
substr(strng, (chrs - offset) , ( chrs - (chrs - (offset + 1)) ) ) ;
Incrementing the offset value will SUBSTR the string backward. May be you could use a derived table and CROSS JOIN it to automate the
offset increment part.
Thanks,
Mahesh
| |