Convert dbf to sql

Free online DBF to SQL converter

Convert legacy DBF tables into SQL scripts for SQLite and other database systems.

Convert DBF to SQL online - free

Uploading…
Selected files exceed the 30 MB total limit. Please select fewer or smaller files.

Your file is processed instantly and deleted as soon as you download it.

How it works

  1. 1/3

    Upload your .dbf file

    Click to browse to select your file you want to convert or simply drag & drop your file into selected area.

  2. 2/3

    Perform .dbf to .sql conversion

    After successful file upload, click to convert when you are ready.

  3. 3/3

    Download converted .sql file

    Conversion result is ready to download.

How to convert dbf to sql file

A legacy accounting, point-of-sale, GIS, or inventory program may store records in a DBF table while a modern database requires an SQL script or imported relational table. Converting the table makes its data available for SQLite, MySQL, PostgreSQL, SQL Server, or text-based archival, but the generated script must match the destination database.

What the DBF format is

DBF, also called dBASE format, stores one table containing field definitions and records. Each field has a name, type, and width; common types include character, numeric, logical, and date fields. Long memo text is often stored in a separate .dbt or .fpt file.

dBASE, FoxPro, Visual FoxPro, Clipper, accounting systems, inventory programs, point-of-sale software, and cadastral applications use DBF tables. A DBF file beside a shapefile usually contains the geographic feature attributes rather than the geometry.

A DBF table normally contains rows and columns only. Relationships, triggers, stored procedures, permissions, and application-specific indexes are generally stored elsewhere or do not exist, so converting one DBF file cannot recreate them.

What the SQL format is

SQL is a database language, not one universal file format. A file with the .sql extension is usually a plain-text script containing statements such as CREATE TABLE, INSERT INTO, and transaction commands. A database engine executes those statements to create and populate tables.

SQL scripts are easy to inspect, edit, version, transfer, and archive. They can recreate DBF records in a relational database, where users can apply queries, indexes, constraints, and relationships. SQL dialects are not interchangeable: SQLite, MySQL, PostgreSQL, and SQL Server differ in identifier quoting, date literals, Boolean values, data types, and auto-increment syntax.

How to convert a DBF file to SQL

Use the converter on 101convert.com

  1. Open the DBF conversion tool on 101convert.com.
  2. Upload the .dbf file and select SQL as the output format.
  3. Start the conversion and download the generated .sql file.
  4. Open the script in a text editor and verify the table definition, character data, row count, and SQL dialect before importing it.

This method requires no installed software and suits a non-sensitive, one-off conversion. Do not upload confidential records unless the service’s handling and retention policies meet your requirements. If the table uses memo fields, supply the associated .dbt or .fpt file when the converter supports companion files; converting only the DBF can omit the memo contents.

Convert with GDAL and SQLite

GDAL is useful for command-line workflows and DBF files from GIS systems. Install GDAL and the SQLite command-line program, then import the table into a SQLite database:

ogr2ogr -f SQLite data.sqlite data.dbf -nln records

Export the imported table as a SQLite SQL dump:

sqlite3 data.sqlite '.dump records' > data.sql

Test the result with:

sqlite3 target.sqlite < data.sql

The resulting file is a SQLite-specific dump. It may require editing before use with MySQL, PostgreSQL, or SQL Server. If the source uses a legacy code page and the installed GDAL XBase driver supports its encoding option, specify the actual encoding, for example:

ogr2ogr -oo ENCODING=CP1252 -f SQLite data.sqlite data.dbf -nln records

Replace CP1252 with the code page used by the source application; an incorrect value changes accented characters and other non-ASCII text.

Quality and compatibility checks

  • Encoding: DBF files may use OEM, Windows, or regional code pages, and the stored declaration may be missing or unreliable. Check names, addresses, and accented text after conversion.
  • Memo data: Long text can reside in .dbt or .fpt sidecar files. Keep the files together and confirm that memo columns contain their full text.
  • Deleted records: DBF applications often mark rows as deleted before physically removing them. Readers may exclude or retain those rows; compare the converted count with the source application.
  • Dates and empty values: DBF dates commonly use YYYYMMDD. Blank numeric fields, invalid dates, and deletion flags need explicit handling during import.
  • Identifiers: Older DBF variants commonly limit field names to ten characters. Names containing spaces, punctuation, reserved words, or duplicates may need quoting or renaming in SQL.
  • Numeric precision: DBF numeric fields specify width and decimal places. Use a suitable SQL DECIMAL definition for financial or fixed-precision values instead of automatically using floating point.
  • Schema loss: A single DBF conversion does not infer relationships, primary keys, foreign keys, indexes, permissions, or application rules. Define these separately after identifying suitable key fields.
  • Dialect: Check the generated CREATE TABLE, quoting, date syntax, Boolean representation, and auto-increment behavior against the destination engine. Test the script on a copy before loading the complete dataset.

DBF vs SQL: format comparison

How the DBF and SQL formats compare on the properties that matter most for this conversion.

Comparison of the DBF and SQL file formats
Property .DBF dBASE Database File .SQL Structured Query Language script
Plain-text readable No Yes
Data types Typed Typed
Nested structures No —
Formulas No No
Multiple tables or sheets No —
Typical file size Small Small
Open standard Partly open Partly open
Best used for Data exchange Data exchange
Introduced 1983 1970
Developer Ashton-Tate / dBASE, Inc. (format origin) —
MIME type application/x-dbf application/sql

Frequently asked questions

Is the DBF to SQL converter free?

Yes, converting DBF to SQL on 101convert.com is completely free. No registration, email address or installation is required. If you need a higher file size limit or want to convert more files at once, see our plans.

How large can my DBF file be?

You can upload DBF files up to 50 MB and convert up to 20 files at once in a single batch.

What happens to my uploaded files?

Files are processed automatically and deleted from our servers within a few minutes after conversion. We never view or share your files.

Do I need to install any software to convert DBF to SQL?

No. The DBF to SQL conversion runs entirely online in your browser and works on Windows, Mac, Linux, Android and iPhone.

Did the conversion fail?

In most cases, the cause is an incorrect file format. Please upload a valid DBF file for this DBF to SQL conversion. Occasionally, the issue may be on our side. We analyze recurring conversion failures and disable or fix the converter if we detect a defect.