0

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
  • 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. Oct 20, 2016 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, 2016 at 0:52

3 Answers 3

1

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.

1
  • 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, 2016 at 6:20
1

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.

-1

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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