Skip to content

CSV to SQL

Turn a CSV file into SQL INSERT statements and a matching CREATE TABLE. The first row names the columns, and each column gets a type inferred from its values, such as INTEGER, DOUBLE, BOOLEAN, DATE or VARCHAR. Choose MySQL, PostgreSQL, SQLite or SQL Server, and the quoting and types follow that dialect.

Reset

Frequently asked questions

How are column types chosen?

Each column takes the narrowest type that fits all its values: whole numbers become INTEGER, or BIGINT beyond 32 bits, numbers with decimals become a floating point type, true and false become BOOLEAN (BIT in SQL Server, INTEGER in SQLite), YYYY-MM-DD becomes DATE and ISO date-times become DATETIME or TIMESTAMP. Everything else is text.

What happens to values with leading zeros?

Values such as 00123 or 007 are treated as text, not numbers, so zip codes, phone numbers and IDs keep their zeros.

How are empty cells handled?

By default an empty cell becomes NULL, and a column with no empty cells gets NOT NULL. Turn off the empty cell option to insert empty strings instead.

How are quotes and special characters escaped?

Single quotes in values are doubled, as standard SQL requires. For MySQL, backslashes are doubled as well, and for SQL Server strings are written as N'...' so Unicode text is stored correctly.

What does rows per INSERT mean?

Rows are grouped into multi-row INSERT statements, 100 per statement by default. Smaller batches suit databases with strict statement size limits, and SQL Server accepts at most 1,000 rows in one VALUES list.

How large can the CSV be?

Up to 10,000 data rows and 200 columns. The delimiter is detected automatically, or you can choose comma, semicolon, tab or pipe.

About OneClick Pro

OneClick Pro is a free collection of more than 150 web tools for everyday work: converting images and units, formatting and validating code, checking domains and SEO, and working with text, dates and numbers. Every tool runs without registration or subscription, and what you enter is only used to calculate your result and is never stored. Use it as a quick toolbox for one-off tasks, or bookmark the tools you rely on every day.