August 28, 2008 at 5:15 am
I am trying to run a simple SSIS import from a flat file to a SQL Server database. However, I have a date stored in the YYYYMMDD format in the input file. I cannot get it to convert into the db.
I get an error that it might loose a value as it tries to auto convert if I change the source column data type from string to date. I get an invalid cast exception if I try to just make the conversion on the SQL Server destination step.
Does anyone have an idea of how I can fix this one?
August 28, 2008 at 6:05 am
hI,
Use Derived column and put
SUBSTRING([Column 2],4,4) + "/" + SUBSTRING([Column 2],5,2) + "/" + SUBSTRING([Column 2],7,2)
in expression and data_type DT_DATE
Thanks!
August 28, 2008 at 7:28 am
nkm has the right idea. The other thing you need to consider is that you have a "bad" value in the text file. Something like 20080631, as there are not 31 days in June. So you may need to verify that you have a valid date.
Jack Corbett
Consultant - Straight Path Solutions
Check out these links on how to get faster and more accurate answers:
Forum Etiquette: How to post data/code on a forum to get the best help
Need an Answer? Actually, No ... You Need a Question
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply