CSV to SQL Converter transforms CSV data into SQL INSERT statements ready to paste into your database. Configure the table name, column names, data type inference, and batch insert size. Supports escaping single quotes, handling NULL values, and optional CREATE TABLE statement generation. Ideal for data migrations, seeding test databases, and one-off data imports.
How it Works
1Paste CSV data or upload a .csv file.
2Configure options: table name, first-row-as-headers, NULL handling, and batch size.
By default, all values are wrapped in single quotes as strings, which works for VARCHAR columns. With type inference enabled, numeric values (no quotes), NULL keywords, boolean values, and ISO date strings are detected and formatted without quotes. Review the output for your specific schema requirements.
How does the tool handle CSV values that contain commas or quotes?
RFC 4180-compliant CSV encloses values with commas in double quotes: 'value with, comma'. Double quotes within a value are escaped as two double quotes: '"'. The parser handles both conventions. If your CSV uses a non-standard delimiter (semicolons, tabs), specify the delimiter in the options.
What is a batch INSERT and why use it?
A batch INSERT groups multiple rows into a single statement: INSERT INTO t VALUES (1,'a'),(2,'b'),(3,'c'). This is far faster than individual INSERT statements (often 10–50x) because it reduces round-trips and transaction overhead. Batch sizes of 100–1000 rows are typical; very large batches can exceed database parameter limits.
Is the generated SQL safe from SQL injection?
String values have single quotes escaped (apostrophes → escaped apostrophes), which prevents basic SQL injection. However, this tool is for data migration and seeding trusted data — not for dynamically inserting user-supplied data in application code. For application code, always use parameterised queries / prepared statements.