Link to home
Create AccountLog in
Avatar of bar0822
bar0822

asked on

Importing flat file dates in ssis

Urgent reply needed.  ...   Importing date columns from a flat file in this format '11/12/2005' however sometimes the date field is blank. The data is coming from the flat file into a table as char(10) then copied over to a table on SQL 2005. (this process worked with DTS) I am now using SSIS 2005 and I am getting an error in ssis and failing.  I've tried to change the oledb destination data type to string to match the char but getting invalid value for cast specification - then tried to change the oledb destination column to datetime instead of string and error again with value could not be converted.  Now, it is failing on some rows because I set the column to ignore error/truncation and some values were passed - so I am thinking that blanks might be the cause? Added an error output to a textfile destination on the specific column and received this in the error column ? -10716076891148 .  I've spent days on this and I have a great headache .. file is needed urgent.  thnx much. forever grateful to whoever can resolve .
SOLUTION
Avatar of lcohan
lcohan
Flag of Canada image

Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of bar0822
bar0822

ASKER

yes the table allows nulls. Looks like all the fields that I can see in the flat file are mm/dd/yyyy and there are empty strings.  Whatever I do I am getting errors.
did you used any conversion trasnform after flat file source? or did you used any other trasnform?
if yes, try to configure error output on transforms and redirect error output to another flat file destination.
if no, try to configure error output on flat file source and redirect error output to another flat file destination.

then you can run the package and find out rows which caused error and troubleshoot them.

Avatar of bar0822

ASKER

I redirected the rows to another flat file destination from the flat file source and all the rows were directed to the flat file source including the blanks and the dates which were mm/dd/yyyy and the error code -10716076891148
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of bar0822

ASKER

ok. I am just learning SSIS - where do i use the isdate(date column, null)
and case statement?
ASKER CERTIFIED SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
SOLUTION
Link to home
membership
Create an account to see this answer
Signing up is free. No credit card required.
Create Account
Avatar of bar0822

ASKER

the solution worked without any problems.  I was able to import from flat file to sql table using convert from a sql statement  - i was having trouble with the data conversion task- ran faster also.