Sequential File - redefining a Varchar as Time
Posted: Thu Jul 29, 2010 3:19 am
Initially, all my Sequential File fields were defined as Varchar and I converted them to proper typed fields in a Transformer with StringToDate and StringToTimestamp.
Now I want to redefine them as Date and Time fields in the source, and drop the Transformer stage.
I set the Type defaults / Time / Format string = %hh:%nn but I'm getting the following warning and no rows:
Field "StartTime" has import error and no default value; data: {2 3 : 0 0}, at offset: 27
What's wrong with 23:00 as a Time value in the format %hh:%nn? Here's my full row of data:
"Run Date","Start Date","Start Time","End Date","End Time"
"2010-07-28","2010-07-27","23:00","2010-08-08","23:00"
When I had a Transformer converting the date and time to a Timestamp with StringToTimestamp( in.StartDate : ' ' : in.StartTime, "%yyyy-%mm-%dd %hh:%nn" ) it worked fine.
I've searched and read most of the results, but those are all about nulls or incorrect contents e.g. strings in numerics or trailing delimiters.
One thing I'm not sure I've done right is to do with the Length - I've kept them as they were for the Varchar fields i.e. the StartTime is a Time field with a Length of 5. Is this correct? *update*: it doesn't seem to make any difference if I remove the Length setting.
*Update*: Or, is it just a bad idea to use data types to specify a CSV, should I just make them all Varchar and then use a Modify stage?
*update*: Back to VarChar with a Transformer, couldn't get a Modify stage to recognize "StringToDate" function.
Now I want to redefine them as Date and Time fields in the source, and drop the Transformer stage.
I set the Type defaults / Time / Format string = %hh:%nn but I'm getting the following warning and no rows:
Field "StartTime" has import error and no default value; data: {2 3 : 0 0}, at offset: 27
What's wrong with 23:00 as a Time value in the format %hh:%nn? Here's my full row of data:
"Run Date","Start Date","Start Time","End Date","End Time"
"2010-07-28","2010-07-27","23:00","2010-08-08","23:00"
When I had a Transformer converting the date and time to a Timestamp with StringToTimestamp( in.StartDate : ' ' : in.StartTime, "%yyyy-%mm-%dd %hh:%nn" ) it worked fine.
I've searched and read most of the results, but those are all about nulls or incorrect contents e.g. strings in numerics or trailing delimiters.
One thing I'm not sure I've done right is to do with the Length - I've kept them as they were for the Varchar fields i.e. the StartTime is a Time field with a Length of 5. Is this correct? *update*: it doesn't seem to make any difference if I remove the Length setting.
*Update*: Or, is it just a bad idea to use data types to specify a CSV, should I just make them all Varchar and then use a Modify stage?
*update*: Back to VarChar with a Transformer, couldn't get a Modify stage to recognize "StringToDate" function.