Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

good tool to quickly import some csv data into sql server [closed]

Every once in a while I find myself typing a one-off script to import some CSV data into a database, doing some column logic (e.g. turn column3 into uppercase) and/or field mapping (column2 in the csv goes to column 3 in de database, etc).

Is there a nice tool which can do this easier?

The least amount of features I'd need is:

  • choosing delimiter
  • Being able to map column X to column Y in the DB
  • setting defaults for columns not in the csv file

SQL server management studio can almost do it, except one can not specify any defaults for values which are not listed in the csv file. So I'd then have to create extra columns in excel first.

like image 246
Toad Avatar asked Oct 18 '10 14:10

Toad


2 Answers

take a look at 6 ways to import data into SQL Server for some ideas, I think SSIS would be your best bet..but there is a learning curve. Or BCP into a staging table, massage the data there and then import intio the real table

like image 127
SQLMenace Avatar answered Sep 19 '22 20:09

SQLMenace


The definitive "best" tool for importing and exporting data to and from SQL Server is, in my opinion, the BCP utility.

Do NOT be put off by the fact that there is no graphical user interface available to you. This tool exposes the widest range of functionality to the coder and also delivers the best performance of all SQL Server ETL Tools, fact.

like image 40
John Sansom Avatar answered Sep 23 '22 20:09

John Sansom