Data extraction · SQL

The client sent a .sql backup and Excel won’t open it. That’s because it’s a script that rebuilds a database. Run it into a scratch database in Navicat, export the tables to CSV, and you’re back on familiar ground.

.sqla rebuild script, not data
1 scratch databaseto hold the rebuilt tables
CSVwhat Salesforce actually loads
3‑minute videoThe full walkthrough
On this page
  1. The problem
  2. 1 · Scratch connection
  3. 2 · Run the .sql file
  4. 3 · Export to CSV
  5. Tips and fixes
  6. Gotchas and FAQ
Watch on YouTube ↗
The problem

A .sql file isn’t data. It’s instructions.

You can’t open a SQL backup in Excel, because it’s a script that rebuilds a database. Run it into a scratch database, then export the tables you need as CSV.

Clients leaving an old system often hand over a .sql backup. Inside are CREATE TABLE and INSERT statements: everything needed to rebuild the database, nothing you can map yet. A database tool runs those statements for you. Navicat Premium is the friendly one if SQL isn’t your day job (DBeaver works too).

A .sql database backup file icon
A .sql backup: a rebuild script, not a spreadsheet.
Comparison of SQL and Salesforce SOQL query syntax
If you know SOQL, SQL will look familiar.

Prefer to read? Everything in the video is written out below.

Step 1

Create a scratch connection.

A local MySQL connection to hold the rebuilt database.

Get Navicat Premium from navicat.com if you don’t have it. You need a MySQL server running on your machine for it to connect to.

  1. On the Navicat home screen open Connections and choose MySQL.
  2. Name it anything, e.g. scratch. Host localhost, port 3306, your MySQL user and password.
  3. Click OK.
Navicat Premium home screen
Navicat Premium.
Creating a new MySQL connection in Navicat Premium
New connection: MySQL, localhost, port 3306.
Step 2

Run the .sql file.

Execute the backup into a new, empty database.

  1. Expand the scratch connection. Right-click it, choose New Database and call it something like client_extract.
  2. Right-click the new database and choose Execute SQL File…
  3. Pick the backup file and click Start. Navicat runs every statement and logs progress.
  4. When it finishes, read the log for errors or warnings before you close it.

Use a new database, not the built-in mysql one. The mysql schema holds the server’s own settings and users. Loading a client’s tables into it mixes the two and makes cleanup messy.

Step 3

Export the tables you need to CSV.

Export Wizard, CSV, pick the tables, keep column titles on.

  1. Expand the database and open Tables. Click one to preview it.
  2. Right-click → Export Wizard → CSV file (*.csv) → Next.
  3. Tick every table you want (several at once is fine) and choose an export folder.
  4. Keep Include column titles on, pick the date order your project uses (e.g. MDY), leave delimiters and text qualifier at their defaults.
  5. Click Start.

Now you have a folder of CSVs. If it’s hundreds of them, the source analysis Claude skill maps out what’s in them before you start mapping.

Before you load anything

Tips, mistakes and fixes.

ProblemFix
Opened the .sql in a text editor and saw codeThat’s normal. It’s a script. Run it in Navicat
Can’t connectCheck host, port, user and password, and that MySQL is actually running
Execute SQL File failsRead the message log. Usually a syntax error or a dump from a different database engine
Dates come out wrong in SalesforceMatch the export date order to what you’ll load, and check for time zones. The date formatting post has the formulas
Exported every tableOnly export what you’ll migrate. Less to map, less to go wrong

When the CSVs reach Data Loader, map to API names. For cleanup formulas, see Data Migration Excel Formulas.

Gotchas

The questions people ask.

Can I import a .sql file straight into Salesforce?
No. Salesforce loads CSVs. Run the .sql into a database, then export tables to CSV.
I don’t have Navicat
DBeaver, MySQL Workbench or SQL Developer do the same job. The steps are nearly identical.
The backup is huge
Make sure you have the disk space and RAM, and export tables in batches if the wizard struggles.
What usually goes wrong in the CSVs?
Delimiters, text qualifiers, character encoding (use UTF-8) and date or number formats.
Data Migration Masterclass

Extraction is only step one.

The Masterclass walks through the whole migration after this: analysing the extract, mapping it, and loading it in the right order.

Know someone staring at a .sql file they can’t open?

Share on LinkedIn
Doing this for a whole org, not just one object?

One CSV is a tutorial. Forty objects, 15 years of history and a go-live date is a project. That’s the part I do for a living.

See how I run migrations →