String to TimeStamp Conversion
Moderators: chulett, rschirm, roy
String to TimeStamp Conversion
I have an input field as below
date_opened
2010-01-05 13:14:16.130
I am reading it as a Varchar and I have also tried Varchar(26).
In my transformer I use :
StringToTimestamp(DSLink35.date_opened,"%yyyy-%mm-%dd %hh:%nn:%ss")
My output is a sequential file and the column is defined as a timestamp.
My problem is :
1) If the input has a value it seems fine but when there is no data on the input my output looks like "*******************". How can I see just a blank instead of the *'s.
2) And eventually I would want to load this into a SQL Server and I am getting an error with the str to ts conversion.
date_opened
2010-01-05 13:14:16.130
I am reading it as a Varchar and I have also tried Varchar(26).
In my transformer I use :
StringToTimestamp(DSLink35.date_opened,"%yyyy-%mm-%dd %hh:%nn:%ss")
My output is a sequential file and the column is defined as a timestamp.
My problem is :
1) If the input has a value it seems fine but when there is no data on the input my output looks like "*******************". How can I see just a blank instead of the *'s.
2) And eventually I would want to load this into a SQL Server and I am getting an error with the str to ts conversion.
Code: Select all
If Trim(DSLink35.date_opened) = '' Then '' Else StringToTimestamp(DSLink35.date_opened,"%yyyy-%mm-%dd %hh:%nn:%ss")
You are the creator of your destiny - Swami Vivekananda
-
- Participant
- Posts: 342
- Joined: Tue Nov 04, 2008 10:38 am
- Location: Chennai, India
-
- Participant
- Posts: 54607
- Joined: Wed Oct 23, 2002 10:52 pm
- Location: Sydney, Australia
- Contact:
Have you got a StringToDate() function in a different derivation?
The error message talks about date_from_string, not timestamp_from_string.
Also, you need a timestamp format string that allows for fractional seconds if you wish to keep these.
The error message talks about date_from_string, not timestamp_from_string.
Also, you need a timestamp format string that allows for fractional seconds if you wish to keep these.
IBM Software Services Group
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.
Any contribution to this forum is my own opinion and does not necessarily reflect any position that IBM may hold.