Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SSIS and Import/Export (2005)
 String to Dataandtime

Author  Topic 

lemondash
Posting Yak Master

159 Posts

Posted - 2010-03-29 : 11:54:01
I have a ssis package that reads in a flat file but the date is stored DDMMYYYY, is there a way i can import the data in to a date and time colunm.

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-29 : 12:21:51
you mean separate date and time alone?

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

visakh16
Very Important crosS Applying yaK Herder

52326 Posts

Posted - 2010-03-29 : 12:23:39
try using derived column to create two columns from it to get date and time parts alone by casting using DT_DBDATE & DT_DBTIME

------------------------------------------------------------------------------------------------------
SQL Server MVP
http://visakhm.blogspot.com/

Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2010-03-29 : 13:58:41
quote:
Originally posted by lemondash

I have a ssis package that reads in a flat file but the date is stored DDMMYYYY, is there a way i can import the data in to a date and time colunm.



The easiest way is to reformat the date into format YYYYMMDD so that it is unambiguous to SQL Server before inserting into a DATETIME column.





CODO ERGO SUM
Go to Top of Page

lemondash
Posting Yak Master

159 Posts

Posted - 2010-03-29 : 16:05:00
i only need the date part so the time can be 00:00:00. so i assume that i can add + '00:00:00' in the expression of the derived column ?
Go to Top of Page
   

- Advertisement -