Developer tools
CSV to SQL
Turn CSV rows into SQL inserts. Review your columns, then save.
Files stay in your browser
1. Input CSV
Paste CSV or choose a UTF-8 file.
Enable JavaScript to convert CSV.
2. SQL settings
Columns
Read columns, then edit names and types. Text is the default; Decimal is an explicit conversion.
No columns loaded yet.
3. SQL output
No output yet
Review before importing. This page does not execute SQL or connect to databases.
How it works
- Add your CSV
Paste or choose a UTF-8 file, then read its columns.
- Review columns
Choose a database and table. Keep Text to preserve exact values.
- Save SQL
Download directly, or preview first. Edits clear previous output.
Your data stays private
Parsing and SQL generation run in your browser. No upload, database connection or browser storage is used. Reset clears the input and output from this page.
Frequently asked questions
How are precision and database compatibility handled?
Text preserves whitespace, quotes and leading zeros. Decimal accepts signed digits with an optional decimal point, without rounding through JavaScript. Importing into SQLite NUMERIC or an existing database column may change precision or formatting. Use Text when exact representation matters.
PostgreSQL uses NUMERIC; MySQL CREATE TABLE derives DECIMAL precision and scale from your values (up to 65 digits and 30 decimal places). MySQL imports need an utf8mb4 connection. Large input and output depend on available browser memory; Cancel stops processing.
What happens to empty cells and missing fields?
Empty cells remain empty strings by default. Enable empty-to-NULL or set an exact, case-sensitive marker to produce SQL NULL. These rules also apply to quoted CSV cells because CSV quoting does not encode a data type. Missing fields in short rows always become NULL and are counted in the result. Extra fields receive generated column names.
Does it infer types or execute cell content?
No automatic type inference is used. Text always becomes a quoted string or text expression; it never becomes executable SQL. Decimal rejects expressions, exponent notation, surrounding whitespace and nonnumeric values. It changes numeric formatting when imported, so use Text for codes and account numbers.
Why might an identifier or value be rejected?
Empty, duplicate or NUL-containing names need editing. PostgreSQL names use the standard build limit of 63 UTF-8 bytes. MySQL names allow 64 BMP characters and cannot end with a space. PostgreSQL text cannot store NUL; SQLite and MySQL output preserve it using text expressions. Names are quoted as single identifiers, not schema paths. Column names must be unique ignoring case, and MySQL table names cannot include a dot or slash.
Can I import into an existing table?
Turn off CREATE TABLE and match your existing column names. The generator does not inspect your schema, keys, constraints, permissions or database limits. Batch size sets rows per INSERT; use smaller batches if your database imposes statement limits.