I have a varchar column with values in the following format. 2012-09-25 00:49:59
I am trying to cast this value into timestamp using the above suggestions but was unsuccessful. Can anyone help here.
Thankx in advance,
Try select cast ('2012-09-25 00:49:59' as timestamp(0) format 'yyyy-mm-ddBhh:mi:ss')
'B' is used to represent the space in the format string!
I am using TPT to load my table.
I am facing an error in converting varchar to TimeStamp(0).
The segment code which is giving the error is :
APPLY ('INSERT INTO '||@TargetTable||'(
TO OPERATOR (LOAD_OPERATOR )
SELECT * FROM OPERATOR ( FILE_READER  );
IDNT_TICK is the column of data type Timestamp(0) which is defined as varchar(14) in the TPT.
Kindly let me know if there are any fixes.
I have a col with data like: 23/11/2015 10:10:00. I want to convert it to Timestamp but it's giving error: Invalid timestamp.
select cast('11/12/2013 00:00:00' as timestamp(0) format 'dd/mm/yyyybhh:mi:ss') as req_time;
The above query works fine. But my data has dates like the below too, which produces error.
select cast('6/8/2013 00:00:00' as timestamp(0) format 'dd/mm/yyyybhh:mi:ss') as req_time;
6/8/2013 does not match with
dd/mm/yyyy, and hence the invalid timestamp error pops up. The varchar field which I am trying to cast to
timestamp(0) has dates like:
'11/12/2013 00:00:00' as well as
Any possible solutions?