import from Excel to SQL

mcrmg
mcrmg used Ask the Experts™
on
Hi,

I have an Excel file that contains several date columns. I need to import them into SQL. (see attached)

When I tried to import into SQL, I got errors that there were some issues when converting the data. If you look at the file, the data is not consistent. Some dates are listed as
6/13/2007
20040407

Is there a way to solve this problem? thanks
test.xlsx
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Software Developer / Linux System Administrator / Managing Director
Commented:
The dates are inconsistently formatted, as you say. If it were me, I would use a temporary table as the destination of the import using a string data type for the date field. I would then use SQL to insert valid rows into the intended target table and clean up the remaining data. Alternatively, I would clean up the source data first, and knowing that it is consistent I would then import it. I am interested to see what other experts would do.

Author

Commented:
thnaks

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial