Search code examples
sqlssisdts

SSIS importing datetime column into SQL Server 2008


I am trying to import a PSV file into SQL Server 2008 using SSIS.

All is working fine apart from one field that contains a datatime.

The contents of the file being imported contains datetime in the format of

2012-08-08T13:31:28.170

The file connector settings, for the PSV file are database timestamp with precision [DT_DBTIMESTAMP2]

The destination column in SQL Server has a datetime datatype.

The result of the package / contents of the SQL table is a datetime import:

2012-08-08 00:00:00.000

You will notice that the mins/secs have not been imported.

I must be using the wrong datetime formats, but seemed to have tried all combinations with no success.

Can anyone point me in the right direction ?


Solution

  • I had a similar situation once where the problem was on my source, not on the destination.

    I suggest you to check the field on the SourceComponent by right clicking it, selecting Show Advanced editor -> imput and Output properties -> Expand "Output columns" -> Slect your column and change to the propper data type (usually [DT_DBTIMESTAMP] works fine for me). Also for the sake of testing, do the same on "Output columns"