TL; DR
Use DT_DBTIMESTAMP as your type and set fastParse to true
Customization
I created a CSV with the following lines. Since SQL Server has a precision of 0.003 ms for datetime, this would ensure that any rounding problems are displayed on the surface
2012-08-08T13:31:28.170 2012-08-08T13:31:28.171 2012-08-08T13:31:28.172 2012-08-08T13:31:28.173
I created a target table
CREATE TABLE [dbo].[datetime2Demo] ( [EventDate] [datetime2](7) NOT NULL , [insert_date] [datetime2](7) NOT NULL DEFAULT(current_timestamp) , [string_type] [varchar](50) NULL ) ON [PRIMARY]
Then I created a connection manager named dt_dbtimestamp and defined one column in the Advanced section named EventDate and the database timestamp [DT_DBTIMESTAMP] data type database timestamp [DT_DBTIMESTAMP]
In my data stream, I added a flat file source and used the above connection manager.
Then I right-clicked on the file with the flat file and selected Show Advanced Editor . On the Input and Output tab, I expanded the Flat File Source output file control and expanded the output columns again, and then selected EventDate. In custom properties, I changed the default value for FastParse from False to True
I had a derived column that added the string_type (DT_STR,20,1252)"DT_DBTIMESTAMP" so that I could keep track of what worked and didn't.
I used the OLE DB assignment and connected it to the table I created.
results
SELECT EventDate, string_type FROM dbo.datetime2Demo
EventDate string_type 2012-08-08 13:31:28.0000000 DT_DBTIMESTAMP2 2012-08-08 13:31:28.0000000 DT_DBTIMESTAMP2 2012-08-08 13:31:28.0000000 DT_DBTIMESTAMP2 2012-08-08 13:31:28.0000000 DT_DBTIMESTAMP2 2012-08-08 13:31:28.0000000 DT_DATE 2012-08-08 13:31:28.0000000 DT_DATE 2012-08-08 13:31:28.0000000 DT_DATE 2012-08-08 13:31:28.0000000 DT_DATE 2012-08-08 00:00:00.0000000 DT_DBDATE 2012-08-08 00:00:00.0000000 DT_DBDATE 2012-08-08 00:00:00.0000000 DT_DBDATE 2012-08-08 00:00:00.0000000 DT_DBDATE 2012-08-10 13:31:28.0000000 DT_DBTIME2 2012-08-10 13:31:28.0000000 DT_DBTIME2 2012-08-10 13:31:28.0000000 DT_DBTIME2 2012-08-10 13:31:28.0000000 DT_DBTIME2 2012-08-08 13:31:28.1700000 DT_DBTIMESTAMP 2012-08-08 13:31:28.1710000 DT_DBTIMESTAMP 2012-08-08 13:31:28.1720000 DT_DBTIMESTAMP 2012-08-08 13:31:28.1730000 DT_DBTIMESTAMP
source share