Menu

CSV to SQL Converter Online (CREATE TABLE & INSERT Statements)

Convert CSV or TSV data to SQL CREATE TABLE and batch INSERT statements online for SQLite, MySQL, PostgreSQL, SQL Server, and Oracle. Runs locally in your browser.

Convert CSV, TSV, or spreadsheet exports into relational database tables and INSERT statements in seconds. Paste your data or load a file; the tool automatically detects delimiters, infers column data types, formats escaped SQL values, and generates dialect-appropriate DDL and batched DML for SQLite, MySQL, PostgreSQL, SQL Server, and Oracle. All processing happens entirely within your browser—no data is sent to SQLiz or any external server.

The CSV to SQL converter requires JavaScript to run in your browser. Please enable JavaScript to use this tool.

How the CSV to SQL converter works

1. In-browser parsing and delimiter detection

The converter parses input text directly in your browser using an RFC 4180-compliant tokenizer. It correctly handles fields surrounded by double quotes (") that contain embedded commas, tabs, semicolons, or line breaks, as well as escaped double quotes ("").

When set to Auto-detect, the parser evaluates candidate delimiters (comma ,, tab \t, semicolon ;, and pipe |) across sample rows and selects the delimiter yielding consistent column counts.

2. Automatic column data type inference

Rather than typing every column as generic text, the converter scans all data rows for each column and identifies the most specific matching type:

  • INTEGER / BIGINT: Assigned to whole numbers within the target engine’s signed integer range. Integers with leading zeros, such as 00123, stay text so identifier formatting is preserved.
  • NUMERIC / DECIMAL: Plain decimal values receive precision and scale based on the input values; values that exceed the target engine’s exact numeric limit stay text rather than being rounded by the converter.
  • FLOAT: Values written in scientific notation (for example, 1.25e3) use a floating-point type. Floating-point types are approximate by nature.
  • BOOLEAN: Assigned when all non-empty values are words such as true, false, yes, or no. Numeric 1 and 0 remain integers because CSV data alone cannot tell whether they are flags or quantities.
  • DATE / TIMESTAMP: Assigned when values match ISO-8601 patterns (YYYY-MM-DD or YYYY-MM-DD HH:MM:SS).
  • VARCHAR(N) / TEXT: Assigned for general text strings. The maximum observed length is measured; columns under 255 characters receive sized VARCHAR definitions, while longer text receives unbounded TEXT, NVARCHAR(MAX), or CLOB.

SQLite has no fixed-scale decimal storage type. Its inferred NUMERIC columns use SQLite’s numeric affinity, so fractional values may be stored as floating-point REAL; use a server database with a decimal type when exact decimal arithmetic is required.

Every parsed data record must have the same number of fields as the header (or the first record when there is no header). Inconsistent records stop conversion with a row number instead of silently dropping extra cells or filling missing ones. Column names that become duplicates after sanitization receive suffixes such as _2. Editing the CSV or conversion options clears the previous SQL output; convert again before copying, downloading, or opening it in another tool.

3. Database dialect specialization

Different relational database engines require specific identifier escaping, type aliases, and multi-row insertion conventions:

Feature SQLite MySQL / MariaDB PostgreSQL SQL Server (T-SQL) Oracle
Identifier Quoting "col" `col` "col" [col] "COL"
String Escaping '' (two single quotes) \' or '' '' N'text' (Unicode) ''
Boolean Values 1 / 0 1 / 0 (TINYINT) TRUE / FALSE 1 / 0 (BIT) 1 / 0
Batch Multi-Row Limit Up to 500 rows Multi-row VALUES Multi-row VALUES Max 1,000 rows per statement INSERT ALL or multi-row
Safe DDL CREATE TABLE IF NOT EXISTS CREATE TABLE IF NOT EXISTS CREATE TABLE IF NOT EXISTS IF OBJECT_ID(...) IS NULL CREATE TABLE CREATE TABLE

4. Interactive playground synergy

You can immediately query your converted data without installing a database server or setting up local software. Click Open in SQLite Playground to transfer your table schema and records into SQLiz’s in-memory SQLite SQL playground. Once loaded, you can run SELECT, WHERE, GROUP BY, window functions, and joins on your data in your browser.

For cross-database multi-row insertion rules and engine limits, see our comprehensive guide on SQL bulk and batch insert by database.

Frequently asked questions

Is my data uploaded or stored on any server?

No. The conversion executes entirely in JavaScript inside your browser. No CSV rows, column names, or generated SQL statements are transmitted over the network or saved on SQLiz servers.

How are single quotes and special characters escaped?

Single quotes within string literals are safely escaped by doubling them (''), which is standard across SQL engines. For MySQL, backslashes are also escaped. For SQL Server, strings are prefixed with N (e.g., N'O''Reilly') to preserve Unicode characters.

Why is there a 1,000-row batch limit option for SQL Server?

SQL Server enforces a strict architectural limit: a single INSERT INTO ... VALUES (...) statement can contain at most 1,000 row value constructors (Error 10738: “The number of row value expressions in the INSERT statement exceeds the maximum allowable number of 1000 row values”). The converter automatically breaks large datasets into compliant 1,000-row chunks for T-SQL.

Can I format the output query for better readability?

Yes. Click Format in SQL Formatter to send the generated SQL to our online SQL Formatter. It applies dialect-aware indentation and keyword casing.