Showing posts with label sqlserv. Show all posts
Showing posts with label sqlserv. Show all posts

Monday, March 12, 2012

Importing DATE with Timestamp(In a Flat file) Column using SSIS

Hi

SSIS is brand new for me.. Playing with since a few hours..

Iam trying to import a Flat File into the SQLSERV DB using SSIS..
One of the column is in this format -- "YYYYMMDDHH24MISS"

How do i get around this to import the data in a readable fashion into the Destination?

Thanks!
MKR

Hi MKR,

What data type are you wanting the result to be?

You can use a derived column component to parse the format of the column and create anything you like -- a DT_DBTIMESTAMP, a string with your own format, etc...

You could turn the string in the format you have above into a string with this format: "YYYY-MM-DD HH:MM: SS" with an expression like this in derived column (where i am assuming the string is in a column called 'Col'):

SUBSTRING(Col, 1, 4) + "-" + SUBSTRING(Col, 5,2) + "-" + SUBSTRING(Col, 7,2) + " " + SUBSTRING(Col, 9,2) + ":" + SUBSTRING(Col, 13,2) + ":" + SUBSTRING(Col, 15,2)

Is that the sort of thing you are looking for?

Thanks
Mark

|||Thanks Mark..

But as i was telling you earlier.. My Knowledge on SSIS is very limited..
Now that i know we can manipulate the string..

Where do i do this -- I mean, where do i add this SUBSTRING Manipulation..

|||You want to add in in the data flow, using a derived column transformation.|||Thanks! Welch n Mark