CSV to SQL Converter

Convert CSV data into SQL CREATE TABLE and INSERT statements with dialect-specific syntax, auto type detection, and batch inserts.

CSV Input

SQL Output

SQL output will appear here after entering CSV data

CSV to SQL Converter

Convert CSV data into SQL CREATE TABLE and INSERT statements with dialect-specific syntax, auto type detection, and batch inserts.

Features

  • Convert CSV to SQL INSERT statements instantly in your browser
  • Support for MySQL, PostgreSQL, SQLite, and SQL Server dialects
  • Auto-detect column types: numbers, strings, dates, and booleans
  • Generate CREATE TABLE with proper column type mapping
  • Batch INSERT mode for efficient multi-row inserts
  • Handle NULL values, quoted fields, and custom delimiters
  • 100% private — no data is sent to any server

How to use

  1. Paste your CSV data into the input area or load sample data.
  2. Configure the table name, delimiter, and quote character if needed.
  3. Select your target SQL dialect (MySQL, PostgreSQL, SQLite, or SQL Server).
  4. Choose the output mode: CREATE + INSERT, INSERT only, or CREATE only.
  5. Toggle batch insert, auto-detect types, and NULL for empty values.
  6. Copy the generated SQL to your clipboard.

Tips & Best Practices

  • Use 'First row as headers' to automatically name columns from your CSV header row.
  • The auto type detection works best with consistent data — mixed types in a column will default to TEXT.
  • For large datasets, batch insert mode generates much more efficient SQL.
  • SQL Server has a 1000-row limit per INSERT, so batches are automatically split.
  • Column names are automatically sanitized to be SQL-safe (lowercase, underscores).

FAQ

Which SQL dialects are supported?

MySQL, PostgreSQL, SQLite, and SQL Server. Each dialect generates proper syntax including identifier quoting (backticks, double quotes, or brackets) and dialect-specific column types.

How does auto type detection work?

The tool analyzes all values in each column to determine the best SQL type. It detects integers, floating-point numbers, booleans (true/false/yes/no), dates (ISO format), and falls back to text for everything else.

What does batch insert do?

Instead of generating separate INSERT statements for each row, batch insert groups multiple rows into a single INSERT statement with multiple value tuples. This is much faster for database imports.

How are empty values handled?

When 'NULL for empty' is enabled, empty CSV fields are converted to SQL NULL. Otherwise, empty text fields become empty strings and empty numeric fields become 0.

Is my data private?

All processing happens in your browser. No data is ever sent to any server or third party.