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)
 import flat text file string date to database date

Author  Topic 

Bostonrose
Starting Member

3 Posts

Posted - 2007-01-30 : 12:01:48
I asked this question below, but the answer was that the conversion will take place automatically, but I can't get that to happen. I have a flat file with an 8 position field that I identify as string (and I also tried date) that is yyyymmdd and it needs to go into the database field that is datetime format. IS there something I am doing wrong with the definition of it, or do I need to add some kind of conversion, and if so, what and how would that be done. I'm a dts Sql2000 expert, but the SSIS thing is driving me crazy. I have a ton of dts' to convert and the migration tool doesn't work because there are a lot of active X scripts in them. thanks for your help. Boston Rose

nr
SQLTeam MVY

12543 Posts

Posted - 2007-01-30 : 12:27:47
Add a derived column task with the expression
(DT_DBTIMESTAMP)(SUBSTRING(dte,1,4) + "-" + SUBSTRING(dte,5,2) + "-" + SUBSTRING(dte,7,2))


==========================================
Cursors are useful if you don't know sql.
DTS can be used in a similar way.
Beer is not cold and it isn't fizzy.
Go to Top of Page
   

- Advertisement -