![](//teradataforum.com/imgs/ptdfw1.gif) |
![](//teradataforum.com/imgs/ptdfw2.gif) |
Archives of the TeradataForum
Message Posted: Mon, 11 Apr 2011 @ 13:21:39 GMT
Subj: | | Re: SUBSTR function and logonsource |
|
From: | | Tewksbury, Kevin |
Haha! I misunderstood the question, but that is nothing new...
I take it that you are trying to pull the id from the logonsource. We have found that it does not always start in the same position, but if
yours happens to and you are sure every id begins in position 55 and position 55 does not have a blank, then you can try and use the position
parameter to find the space at the end of your substring.
SEL
.
.
.
,SUBSTRING(c.userid FROM 1 FOR POSITION (' ' IN c.userid)) AS "User_id"
.
.
FROM
(
SEL
.
.
.
,SUBSTR(b.logonsource,55,17) AS "UserID"
.
.
FROM dbc.AccessLog a,
dbc.LogOnOff b
) c
Kevin R Tewksbury
Sr. Database Administrator
LimitedBrands
Limited Technology Services
| |