CSV to INSERT Statement Generator

Convert CSV, Excel copy-paste, or tab-separated data into SQL Server INSERT statements. Quotes are escaped, numbers are detected safely, and rows are batched to SQL Server's 1,000-row limit. Your data never leaves your browser.

How to use it

Paste CSV text, copy cells straight from Excel, or open a .csv file. Set the target table name, then click Generate SQL. Column names come from the first row and are wrapped in square brackets, so names with spaces or reserved words work.

A column is left unquoted only when every value in it is a plain number with the same number of decimal places (otherwise SQL Server could store 1 as 1.0). Values with leading zeros (like ZIP codes 02134), commas, currency symbols, or dates are kept as strings, and SQL Server converts them to the target column's type on insert.

FAQ

Why are the INSERTs split into groups of 1,000 rows?

SQL Server allows at most 1,000 rows in a single INSERT ... VALUES statement (error 10738 otherwise). The generator starts a new INSERT every 1,000 rows, or sooner if you set a smaller number.

How are quotes and apostrophes handled?

Single quotes inside values are doubled (O'Brien becomes N'O''Brien'), which is how T-SQL escapes them. Quoted CSV fields can contain commas, line breaks, and doubled double-quotes.

Should I use N'...' strings?

Keep it on if the target columns are nvarchar or the data has accented or non-Latin characters. For plain varchar columns with ASCII data, either works.

Does it create the table?

No. It generates INSERT statements for a table that already exists. Make sure the column names in your first row match the table.

Is there a size limit?

Only your browser's memory. Tens of thousands of rows work fine. For millions of rows, BULK INSERT or the SSMS Import Flat File wizard is a better fit.

Is my data uploaded?

No. Parsing and SQL generation happen in your browser, and the site's security policy blocks the page from sending data anywhere. Opening a file reads it locally.

Practice T-SQL on a realistic database

The Bramble Cycles SQL Workbook has 120 hands-on SQL Server exercises on a three-store bike shop database, from your first SELECT to window functions and index tuning. Every exercise has a check line and an answer key.