I have a CSV file and I want to convert it into a SQL INSERT statements.But I could only find online converters but I would like to know can I create it manually ?

  • 2
    You can try to bulk load it into a database and export again, this time as INSERT statements. OTOH, why do you need this? It would be slower on any system I've seen so far, compared to the bulk load options. – dezso Oct 20 '16 at 8:23
  • The problem is I cannot insert the CSV file into the table because I am using hana database and importing an array column which cannot be loaded by a CSV file. – priyanka3 Oct 21 '16 at 0:52

You could open it in Excel then write a concatenate function that builds an insert statement, then copy it down the rows.

But if you really just want to get the data into a table, you could load it using the 'SQL Server Import and Export Wizard', or build an SSIS job to do it.

| improve this answer | |
  • 3
    Why do you think he's using MS SQL Server? The question is just tagged sql (well, Microsoft seems to be quite successful in trying to establish SQL as synonym for SQL Server) – dnoeth Oct 20 '16 at 6:20

Check out Data Transformer (disclosure - I'm its developer). It can convert from CSV, JSON, XML to SQL. The generated SQL contains "insert" statements for each line and a "create table" statement. The "create table"

The app works offline, and your data never leaves your computer.

You can get it from the Mac App Store or the Microsoft Store.

| improve this answer | |

It is better to import the csv file into a table than the insert query I think background also takes same insert query preparation while importing csv file

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.