Want to convert TXT file to SQL file?
Try Withdata Data File Converter, a desktop TXT to SQL converter for Windows, MacOS, and Linux, Convert TXT to SQL, Easy and Fast.
- Can run in GUI mode, Step by Step, just a few mouse clicks.
- Can run in Command line, for Scheduled Tasks and Streams.
- Convert files locally and privately, avoid uploading large TXT file(s) to online services.
- Support Windows, Linux, and macOS.
Download Withdata DataFileConverter
Windows 64 bit
Windows 32 bit
Linux .deb (For Debian, Ubuntu) 64 bit
Linux .rpm (For Red Hat, Fedora, SUSE) 64 bit
MacOS 64 bit
If you want to import TXT file to SQL Server, see this page: TXT to SQL Server.
If you want to import TXT file to SQLite, see this page: TXT to SQLite.
Convert TXT to SQL
Choose TXT file -> Set SQL file -> Convert TXT to SQL
“Start a New Convert” for “TXT to SQL”.
Select From “File” “TXT” To “File” “SQL”.
1. Open source TXT file.
Support large TXT file ( > 4GB ).
Don’t worry about the delimiter, DataFileConverter will automatically determine the delimiter, includes comma, tab, colon, semicolon, pipe, hash (octothorpe), slash, asterisk, white space, and you can also enter a delimiter.
Source TXT file’s content is like this:
2. Config target SQL file.
3. Set rows options.
4. Convert TXT to SQL.
After converting, you can view the output SQL file.
More about TXT to SQL converter
Download Withdata DataFileConverter
Windows 64 bit
Windows 32 bit
Linux .deb (For Debian, Ubuntu) 64 bit
Linux .rpm (For Red Hat, Fedora, SUSE) 64 bit
MacOS 64 bit
See Video: Convert TXT file to SQL file
See also:
TXT → SQL reference
Type mapping
| Value kind | in TXT | in SQL |
|---|---|---|
| Int | 1234, or right-aligned in a fixed-width column | INT |
| Bigint | 9007199254740993 | BIGINT |
| Decimal | 1234.56 | DECIMAL(p,s) |
| Float | 1.234e+10 | DOUBLE PRECISION |
| Text | written as-is; padding depends on the chosen layout | VARCHAR(n) |
| Long text | written as-is | TEXT / CLOB |
| Date | whatever the writer chose | DATE |
| Datetime | whatever the writer chose | TIMESTAMP |
| Binary | not representable | BLOB / BYTEA |
| Boolean | Y / N, or 1 / 0, or TRUE / FALSE | BOOLEAN / SMALLINT |
| JSON | written as-is | JSON / TEXT |
Dialect differences
Both TXT and SQL are file formats, so what differs below is how each one chooses to represent a value.
| Property | in TXT | in SQL |
|---|---|---|
| identifiers | None by convention | Two competing conventions: single-quoted literals and diale... |
| dates | Whatever the writer produced; no convention is guaranteed | Depends on the dialect: DATE literals, TO_DATE(), or plain ... |
| binary | Not supported | Dialect-specific: X-quoted literal, 0x hex, or decode() |
| separator | Whatever was chosen - often fixed column widths | Statement terminators (;) |
| encoding | No declaration - UTF-8 works only with a BOM | No declaration |
| typing | None - every field is text | Types belong to the target database, and they differ betwee... |
| shape | Free form; a parser has to be told the layout | Statements; a dump usually means CREATE TABLE plus INSERT rows |
| ceiling | No formal limit | No formal limit, but a single INSERT statement has to fit i... |
Convert TXT to SQL the easy way
Use the TXT to SQL converter — an offline desktop app for Windows, macOS and Linux. Nothing to upload, large files and batch runs supported (free trial).