How to Convert TSV to SQL
Loading tab-separated data into a database usually means writing a schema and a pile of INSERT statements by hand. This converter does both for you. It reads your TSV, treats the first row as column headers, and scans every value in each column to infer a sensible type — INTEGER for whole numbers, DECIMAL for decimals, BOOLEAN for true/false, and TEXT for everything else. It then emits a CREATE TABLE statement followed by INSERT statements, with text values safely single-quoted, inner apostrophes doubled, and empty cells written as NULL. Set your table name, choose one INSERT per row or a single fast multi-row INSERT, then copy or download. Everything runs in your browser, so nothing is uploaded.
Paste your TSV
Paste tab-separated data with a header row, or load the sample; it's parsed locally.
Set the options
Name the table and choose single or multi-row inserts.
Copy or download
Grab the SQL with one tap or save it as a .sql file.
TSV vs SQL — What's the Difference?
TSV — tab-separated values
A flat text format where each line is a row and tabs separate columns. It's compact and pastes perfectly from spreadsheets, but it has no schema and no types — everything is plain text.
SQL — structured statements
Statements a database runs to build tables and add rows. A CREATE TABLE defines typed columns and INSERTs add the data. Converting TSV to SQL turns loose tabular text into a real, typed table your database can execute.
Common Use Cases
Seed a database
Turn a spreadsheet export into a table plus inserts to seed a dev database.
Bulk data loading
Use a multi-row INSERT to load many records quickly.
Migrations
Generate schema and data statements from tabular data for a migration.
Prototyping
Spin up a realistic table from sample data in seconds.
Spreadsheet to DB
Copy columns straight from Excel or Sheets — they paste as TSV — and get SQL.
Test fixtures
Produce repeatable INSERTs for automated test setups.
Teaching SQL
Show learners how a table and its inserts are structured from real data.
Quick imports
A fast, no-install way to load tabular data into any SQL database.
Tips & Best Practices
Keep a clean header row
Header names become column identifiers, so clear, simple names give you a tidy schema.
Check the inferred types
Types are guessed from the data; review the CREATE TABLE and adjust if a column needs a different type.
Use batch inserts for big loads
A single multi-row INSERT is much faster than one statement per row for large datasets.
Mind boolean values
true/false and 0/1 are read as BOOLEAN; if you need them as text, they'll type differently.
Review before running
Always sanity-check generated SQL against your database's dialect before executing it.
IDs with leading zeros
A column like 007 will be typed as text if any value isn't purely numeric, preserving the zeros.
Troubleshooting
Columns split wrongly
This tool expects tab-separated input. If your data uses commas, use our CSV to SQL converter instead.
A number became TEXT
If any value in that column isn't purely numeric — even one — the whole column is typed as TEXT to stay safe.
My dialect rejects a type
Type names vary between databases. Adjust DECIMAL, BOOLEAN or INTEGER in the CREATE TABLE to match your engine if needed.
The table name looks changed
Table and column names are sanitised into valid SQL identifiers, so spaces and symbols become underscores.
Frequently Asked Questions
How do I convert TSV to SQL for free?
Paste your tab-separated data above and SQL appears instantly — a CREATE TABLE plus INSERT statements. Copy it or download a .sql file, free and no signup.
Does it create the table too?
Yes. You get a full CREATE TABLE statement with inferred column types, not just the inserts.
How are column types decided?
Each column is scanned across all rows and typed as INTEGER, DECIMAL, BOOLEAN or TEXT based on its values.
Are apostrophes handled safely?
Yes. Text is single-quoted and any inner apostrophe is doubled, so values like O'Brien don't break the SQL.
What happens to empty cells?
Empty cells are written as NULL rather than empty strings, which is usually what a database expects.
Can I choose the table name?
Yes. Set any table name; it's sanitised into a valid SQL identifier automatically.
What is a multi-row INSERT?
Instead of one INSERT per row, all rows go into a single INSERT ... VALUES statement, which loads much faster for big datasets.
Which databases does it work with?
The output uses standard SQL that works with MySQL, PostgreSQL, SQLite and more; you may tweak type names for your dialect.
Are column names made safe?
Yes. Header names are cleaned into valid identifiers, so spaces and symbols become underscores.
Does it handle booleans?
Yes. Columns containing only true/false or 0/1 are typed BOOLEAN and written as TRUE/FALSE.
Is my data sent to a server?
No. Everything happens inside your browser, so your data never leaves your device.
Can I download the result?
Yes. Save the output as a .sql file, or copy it straight to your clipboard.
How large a file can it handle?
It comfortably converts thousands of rows, all within your browser.
Does the first row have to be headers?
Yes. The first row is used as column names; make sure your data has a header row.
Can I convert CSV instead?
Yes — use our CSV to SQL converter for comma-separated input.
What SQL is used for numbers?
Whole numbers become INTEGER and decimals become DECIMAL(10,2); adjust the precision in the schema if needed.
Does it work on phones?
Yes, in any modern browser on Windows, Mac, Android or iPhone with nothing to install.
Is this converter really free?
Completely free, forever — no account, no ads and no premium wall.
100% free · No signup · Processed in your browser · Data never sent
Last updated: August 2026 · FlipMyFormat TSV to SQL Converter
Written and maintained by the FlipMyFormat team · Runs entirely in your browser