Convert time from Excel to MS SQL

Hi,

I'm trying to use the MS SQL 2008 Import and Export Data to convert an Excel spreadsheet with per minute stock data into MS SQL. One example of the time shown in the spreadsheet is '16:40' for 4:40PM.

When I get to the column mappings section of the wizard, when I change the 'type' from 'varchar' to 'time', I get an error message saying 'Found 1 unknown column type conversion(s)'.

I tried using both a csv and a text file. I tried adding seconds to the time in Excel ie 16:40:00. Neither of these debugging attempts worked.

What else should I try? For example, is there a different way to format the time in Excel which would be accepted by the export wizard?

Thanks.
GoldenBearAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

cyberkiwiCommented:
It should work just by setting the field type to "date" (or datetime)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
cyberkiwiCommented:
Or try this:

Put in a data conversion task in between the reading of the Excel file and the writing to the SQL table.
Set it to convert all time values to DT_TIME instead of just relying on it reading metadata correctly.
0
GoldenBearAuthor Commented:
Thanks, this worked. SQL ends up inserting some date (1899-12-30) into the field but it'll work for what I need. If I need to get more specific, I can probably combine the date and time Excel columns together into one.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft SQL Server 2008

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.