Archives of the TeradataForum
Message Posted: Mon, 11 Apr 2005 @ 09:51:24 GMT
Subj: | | Re: Extracting piece of data from a string of text |
|
From: | | Allan Holmes |
You can also extract the string if you don't know its length by determing the length of the field.
Ie
cast(SUBSTRING(sub01.temp01 FROM POSITION(' ' IN sub01.temp01) + 1 FOR
CHARACTER(sub01.temp01) - (POSITION(' ' IN sub01.temp01))) as int) as
DerivedFieldName
I use this when extracting Stock figures where I concatenate transaction date & time & soh, then strip out the soh data. I also use it
for extracting names, suburbs, post-codes etc etc. However, the down-side is, you can only use it if there is no trailing data
|