 |
 |
Archives of the TeradataForum
Message Posted: Tue, 19 Aug 2003 @ 09:42:02 GMT
| Subj: | | Re: Help with TRIM and SUBSTR |
| |
| From: | | Dieter Noeth |
Anomy Anom wrote:
| | $MOBM$UIFPRIVATE&D&H
$MOBM$UIFCUSTKNOWBRC&D&H
$MOBM$UIFBUSINESSTK&D&H | |
| | I want to get only the characters starting from position 8 onwards till the position '&D&H' | |
| | IFPRIVATE&D&H
IFCUSTKNOWBRC&D&H
IFBUSINESSTK&D&H | |
Including '&D&H'?
Is '&D&H' always the last chars?
SUBSTRING(a FROM 8).
If not
SUBSTRING(a FROM 8 FOR POSITION('&D&H' IN q) - 4)
Or excluding '&D&H'?
SUBSTRING(a FROM 8 FOR POSITION('&D&H' IN q) - 8)
| | I can use the substring function with the TRIM TRAILING command but TRIM only trims 1 character, which is a limitation. | |
| | I then used the INDEX to get the position, but this command fails. Any suggestions. | |
INDEX is not Standard SQL, use POSITION instead.
| | sel substring (a FROM 8 FOR INDEX (a, '&D')) from test | |
It's not failing, you just forgot " - 8" ;-)
Dieter
| |