Page 1 of 1
trying to truncate the string
Posted: Tue Dec 12, 2006 11:23 am
by gayatri
Hi,
I am trying to truncate part of the string. This is the raw data.
1/1/2007 0:00:00
I only need date from this. How can i extract only the date.
I used Left function, not working. Is there any truncate function in datastage that I can use.
Thanks
Posted: Tue Dec 12, 2006 11:25 am
by DSguru2B
Welcome Aboard
Use the Field Function. Use DataStage help to see how it works.
For your problem, use this
Posted: Tue Dec 12, 2006 11:49 am
by gayatri
DSguru2B wrote:Welcome Aboard :P
Use the Field Function. Use DataStage help to see how it works.
For your problem, use this
I used this function. I am getting this error.
Field(in.Col, "0:00:00 ",1)
it returned
"1/1/2"
Please correct me if I am doing this wrong.
Posted: Tue Dec 12, 2006 11:54 am
by johnthomas
Try extracting using string function the date portion from timestamp , since leanth of the date portion varies depending whether its a 1 digit day or month
Posted: Tue Dec 12, 2006 11:59 am
by johnthomas
try Field(in.Col, " ",1) in place of Field(in.Col, "0:00:00 ",1) as suggested by dsguru
Posted: Tue Dec 12, 2006 12:07 pm
by narasimha
As mentioned above use
You are using
Posted: Tue Dec 12, 2006 12:50 pm
by DSguru2B
In the expression that i provided earlier, "in.Col" is your input column. You need to replace that with your inputlink.columnname.
Posted: Tue Dec 12, 2006 3:01 pm
by gayatri
DSguru2B wrote:In the expression that i provided earlier, "in.Col" is your input column. You need to replace that with your inputlink.columnname. ...
Thanks so much function worked
but I am getting another error now
SQLSTATE=22008, DBMS.CODE=0
[DataStage][SQL Client][ODBC][Oracle][ODBC]Datetime field overflow.
Any suggestions.
Posted: Tue Dec 12, 2006 4:21 pm
by DSguru2B
Posted: Tue Dec 12, 2006 10:53 pm
by kumar_s
If you are using database stage, you can use TO_DATE() to convert it into the required date format.