PKTG
asked on
How to convert varchar column into timestamp format with Data Conversion(SSIS Data Flow Item)?
I am getting date column in the source file(.csv) like 20080727063005. I need to load this value into Sql Server table as Datetime data type column.(yyyy-mm-dd hh:mi:ss FORMAT) Hope i can do it with Data Conversion . But i am new to SSIS. So can you please tell me how to solve this problem with Data conversion? or Is there any other easy method please let me know.
Thanks in advance.
Thanks in advance.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
I believe you can...but I have not tested it...
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Here is the expression
SUBSTRING(DateString,1,4) + "/" + SUBSTRING(DateString,5,2) + "/" + SUBSTRING(DateString,7,2) + " " + SUBSTRING(DateString,9,2) + ":" + SUBSTRING(DateString,11,2) + ":" + SUBSTRING(DateString,13,2)
Here is the return values
DateString,DATE
20080727063005,2008/07/27 06:30:05
SUBSTRING(DateString,1,4) + "/" + SUBSTRING(DateString,5,2) + "/" + SUBSTRING(DateString,7,2) + " " + SUBSTRING(DateString,9,2) + ":" + SUBSTRING(DateString,11,2)
Here is the return values
DateString,DATE
20080727063005,2008/07/27 06:30:05
ASKER
I am converting flatfile datestring to another flat file with SSIS package. With drived column , i gave the below expression with DT_Date datatype.
SUBSTRING(DateString,1,4) + "-" + SUBSTRING(DateString,5,2) + "-" + SUBSTRING(DateString,7,2) + " " + SUBSTRING(DateString,9,2) + ":" + SUBSTRING(DateString,11,2) + ":" + SUBSTRING(DateString,13,2)
I expect it will return datestring value like 2008-07-22 21:58:36 but it shows 7/22/2008 9:58:36 PM.
But I need to display like 2008-07-22 21:58:36 . Can you please advise me how to fix this? Thanks.
SUBSTRING(DateString,1,4) + "-" + SUBSTRING(DateString,5,2) + "-" + SUBSTRING(DateString,7,2) + " " + SUBSTRING(DateString,9,2) + ":" + SUBSTRING(DateString,11,2)
I expect it will return datestring value like 2008-07-22 21:58:36 but it shows 7/22/2008 9:58:36 PM.
But I need to display like 2008-07-22 21:58:36 . Can you please advise me how to fix this? Thanks.
ASKER
SUBSTRING(column0,1,4)+'-'
SUBSTRING(column0,5,2)+'-'
SUBSTRING(column0,7,2)+' '+
SUBSTRING(column0,9,2)+':'
SUBSTRING(column0,11,2)+':
SUBSTRING(column0,13,2) as STRT_TMST
Now i am in the situation to do it via SSIS. I can use this scrip in Exec SQL task. But Can you please tell me is it possible to do with Data Conversion Task? Thanks.