r/DatabaseHelp • u/marcus13345 • Sep 17 '15
On uploading CSV data to SQL
After searching around on the subject, i found everyone uses the local filesystem and does a bulk insert. As much as i would like to jump on that bandwagon, at my work we don't have access to the local filesystem; only the database. Am i missing something that allows uploads into the filesystem via SQL? or does everyone else also have an FTP set up?
2
Upvotes
1
u/EschersEnigma Sep 17 '15
What's preventing you from doing it piecemeal directly from the software? Parse in your csv data and then call your SQL injections.
1
u/WhippingStar Sep 17 '15 edited Sep 17 '15
JDBC or ODBC will allow you to load data remotely. Using the local file system and using something like BCP,SQLLDR,tpump,nzload,etc(some of these work remotely, some don't) I would call a bulk loader. Since most databases have a way to insert multiple rows with one insert statement, this is usually referred to as a bulk insert and can be done with JDBC/ODBC.
1
u/jeffrey_f Sep 17 '15 edited Sep 17 '15
If your machines can share a folder, (assuming windows) you can load via UNC path
SQL Studio for MS SQL Server or MySQL Workbench for MySQL.....have tools for such things. Then, both have a command line util
You can also script these imports. No matter what you do, thousands of records WILL take a little while to process. Even worse when this amount grows. You should have a small server just dedicated to being a repository for these imports which automatically processes the imports then archives them (don't forget to purge)