How to convert TXT to SQL
- Drop your TXT file on the box above, or paste its content into the text box.
- Check the settings below the box; the defaults suit most files.
- Press Convert. You see a preview or a summary of the result.
- Download the .sql file, or copy the text.
What is kept when you convert TXT to SQL
- Each line becomes a row and each field a value; with a header line, its names become the column names.
- Strings are quoted for the database you choose — doubled single quotes everywhere, doubled backslashes for MySQL, N'…' for SQL Server.
- A column becomes numeric only when every value in it is a plain number without leading zeros, so IDs like 007 stay text.
Example
A short TXT input and the exact output this tool produces from it:
Input
name city score
Smith, John London 42
Anna Berlin 007 Output
CREATE TABLE "people" (
"name" TEXT,
"city" TEXT,
"score" TEXT
);
INSERT INTO "people" ("name", "city", "score") VALUES
('Smith, John', 'London', '42'),
('Anna', 'Berlin', '007');
About TXT and SQL files
A .txt file is plain text: characters and line breaks, with no fonts, sizes or layout. It is what Notepad, TextEdit, code editors and many export buttons produce. It opens in any text editor.
A .sql file is a script of statements — here a CREATE TABLE and INSERT statements — that a database runs to create and fill a table. It opens in MySQL, PostgreSQL, SQLite, SQL Server and their clients.
Good to know
- If accented letters show up as é or ?, the text file was saved in an older Windows encoding; this tool reads UTF-8 and falls back to Windows-1252 automatically, so open the result and check one accented word.
- Run the script inside a transaction (BEGIN … COMMIT) on a test database first, so a mistake can be rolled back.
Privacy and limits
The file is read and converted by this page in your browser; there is no upload and no account. Files up to 25 MB are accepted; a file of the wrong type or a damaged file is rejected with the reason.