Use this tool to convert CSV to SQL statements. Buy ConvertCSV a Coffee at ko-fi.com

This conversion is now available as an API at ConvertCsv.io

What can this tool do?

  • INSERT, UPDATE, DELETE, MERGE, and SELECT statements can be created.
  • CREATE TABLE, DROP TABLE, CREATE VIEW, DROP VIEW are optional.
  • The key used in UPDATE, DELETE, and MERGE is specified by setting the key column.
  • New Now it is easy to merge csv into a database table by using the new Generate MERGE feature.
  • A field value may be trimmed, made uppercase, or lowercase. You can add custom text around the field value by using the template feature. For example, if you are using Oracle and want to convert a field in YYYYMMDD format to DATE, use TO_DATE({f},'YYYYMMDD'). Likewise for Sql Server, use CAST({f} AS DATETIME). The field value will be substituted for {f}.
  • Current version supports some database specific output and support ORACLE, MYSQL, SQL SERVER, PostreSQL and ANSI SQL databases. There are slight variations in the way different databases handle NULLs, empty strings, DATES, etc. .

What are my options?


  • You can specify which fields to include and specify the name of the field.
  • You can choose to quote your column names as appropriate for your database engine.
  • You can sort the output by column name.
  • You can use NULL for empty fields.

See also SQL to CSV and JSON to SQL

Step 1: Select your input




   
Encoding
 

 
 

Step 2: Choose input options (optional)


Input Options
  

Field Separator:




Step 3: Choose output options


Output Options
 
Sort CSV  
 Field #TypeDirection
First By
Then By
Then By



NOTE - you can change the column names below by overwriting the Field Name value.

   


 
 

For INSERT (REPLACE INTO tablename ....)

(INSERT phrase INTO ...)
For SELECT and MERGE
Valid if not creating VIEW for SELECT

  NULL value:
See Moment.js

Step 4: Generate output



.sql

NEW -You can now Save the complete data and settings, and then later Load them from your saved file.