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

AI Thread Summary
When importing legacy files into an SQL database, users are exploring alternatives to Microsoft's import/export Wizard. For smaller batches, the Wizard is recommended, but for larger datasets, a custom program may be necessary. The BULK INSERT command is mentioned as a potential solution for importing files, particularly CSVs, although the specific file formats it supports are not detailed. The discussion also touches on the importance of having a similar database schema to the flat files for successful imports. A Java application is suggested for those comfortable with programming, with the potential for a concise codebase depending on the complexity of the data differences. Groovy is also mentioned as a viable alternative to Java, noted for its scripting capabilities and ease of use. The conversation hints at the possibility of further exploration of Groovy's advantages in a future article.
WWGD
Science Advisor
Homework Helper
Messages
7,678
Reaction score
12,360
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?
 
Technology 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 WWGD
If memory serves BULK INSERT imports files wholesale. No idea what file formats it supports, except I used it for CSV.
 
  • Like
Likes 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:
 
  • #10
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...
 
  • #11
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 jedishrfu
Back
Top