Importing flat files (e.g.) Excel directly into SQL Database

Join the discussion
Registration is free. Ask a follow-up in this thread, or start your own.
10 replies · 2K views
Science Advisor
Homework Helper
Messages
7,844
Reaction score
13,167
Hi all,
I have a bunch of legacy files I am trying to import directly into an .sql database. Is there a way of doing this other than by using Microsoft's import/export Wizard?
 
Physics news on Phys.org
What do you mean by a bunch? If it's a dozen or so, then use Microsoft's wizard. If it's a lot more than that, I would write a custom program.
 
  • Like
Likes   Reactions: WWGD
If memory serves BULK INSERT imports files wholesale. No idea what file formats it supports, except I used it for CSV.
 
  • Like
Likes   Reactions: WWGD
Thank you all, does the database schema need to be similar to the flat files for the import to go through?
 
Borg said:
What do you mean by a bunch? If it's a dozen or so, then use Microsoft's wizard. If it's a lot more than that, I would write a custom program.
Thanks, what type of program would that be?
 
WWGD said:
Thanks, what type of program would that be?
Since I'm a Java programmer, it would be a Java application. Probably no more than a hundred lines of code depending on how complex the differences are between the files and the database.
 
Borg said:
Since I'm a Java programmer, it would be a Java application. Probably no more than a hundred lines of code depending on how complex the differences are between the files and the database.

It could be Groovy too. Its a lot cooler than Java and all its formalism. Just sayin...
 
jedishrfu said:
It could be Groovy too. Its a lot cooler than Java and all its formalism. Just sayin...
Like I don't have enough problems at work with the last cool thing that someone decided to use. :cool:
 
No really, groovy is something you'd like its java as a scripting language. It has some things in it that you wished java had but doesn't. I've used it to protoype developer tools that used our project libraries but were easily reconfigurable.

But I digress... so as not to derail the thread in other paths...
 
jedishrfu said:
No really, groovy is something you'd like its java as a scripting language. It has some things in it that you wished java had but doesn't. I've used it to protoype developer tools that used our project libraries but were easily reconfigurable.

But I digress... so as not to derail the thread in other paths...
Sounds like it might make a good Insight article. :oldwink:
 
  • Like
Likes   Reactions: jedishrfu