# Moving from SQL Server, Access or another database

This guide shows how to export data from SQL Server, Access or a phone app. The files can also be sent to TowConnect for import.

Some old systems have no **Export** button, because they keep everything in a database. This guide covers the 3 most common, and the shortest way to export from each. If any of it looks like hard work, see **Sending it to TowConnect instead**. TowConnect does this free of charge and names the day the data will be ready.

## SQLite files (.sqlite, .db): send them as they are

Phone job apps and small dispatch tools often keep everything in a single `.sqlite` or `.db` file. **It does not need converting.** TowConnect support imports a file sent through a support ticket, free of charge.

The file is usually next to the app's own backup or export option. Look for a file ending in `.sqlite`, `.sqlite3`, `.db` or `.db3`.

> **Close the old app before copying its database, or use the app's own backup or export.** Most phone apps keep the most recent records in a second file beside the database, with the same name ending in `-wal`. A copy of the database on its own, made while the app is running, misses the newest jobs.

## Microsoft SQL Server: export to CSV from SSMS

A `.bak` file is a backup, not an export, and only SQL Server can open one. With SQL Server Management Studio (SSMS), clean CSV files can be exported in about 20 minutes.

1. Connect to the server in **SSMS** and find the database in **Object Explorer**.
2. Right-click the database and choose **Tasks → Export Data…**.
3. For the data source, choose **Microsoft OLE DB Driver for SQL Server** (on older installs, **SQL Server Native Client**), pointed at that database. For the destination, choose **Flat File Destination**.
4. Choose a file name ending in `.csv`, tick **Column names in the first data row**, and leave the format as delimited with a comma.
5. Choose **Copy data from one or more tables or views**, tick the tables to export (jobs, customers, vehicles, invoices, drivers and trucks), and run the export.
6. Repeat for each table, because SSMS writes one file at a time. Then upload the CSV files to TowConnect, clients before jobs.

> Without SSMS or a server, send the `.bak` file through a support ticket instead. Restoring a backup is TowConnect's job, not the business's.

## Microsoft Access: the export wizard

1. Open the `.mdb` or `.accdb` file in Access.
2. In the left pane, click the table to export. Start with customers or clients.
3. Choose **External Data → Export → Text File** and give the file a name ending in `.csv`.
4. Choose **Delimited** and a comma, tick **Include Field Names on First Row**, then click **Finish**.
5. Repeat for each table, then upload the CSV files to TowConnect.

> Access files often hold a lot of tables with unclear names. There is no need to work out which is which. If they are all exported, TowConnect then says what is in each. The file can also be sent to TowConnect.

## Other databases

For MySQL and MariaDB, run `mysqldump -u user -p dbname > backup.sql`. For PostgreSQL, run `pg_dump --format=plain dbname > backup.sql`. TowConnect support imports a `.sql` file sent through a support ticket.

```
mysqldump -u root -p my_old_app > backup.sql
pg_dump --format=plain my_old_app > backup.sql
```

For records still on paper, or in a spreadsheet that is not really a spreadsheet, the **Import data** screen offers a blank template as an Excel or CSV file. It has the right column headings and one example row to type over. Fill it in at any pace and upload it when it is ready.

## Sending it to TowConnect instead

Open **Support → New ticket** and choose **Data migration**. Attach the files to the ticket. TowConnect support imports them free of charge and names the day the data will be ready. The ticket accepts `.bak`, `.mdb`, `.accdb`, `.sql`, `.sqlite` and `.db` files, spreadsheets, and ZIP files of any of them.

- Each message can carry up to **5 files**, each within the upload limit. A real SQL Server backup is usually bigger. **Zip it first**, because backups compress well. It can also be split and sent in several replies.
- If it is still too big when zipped, say so on the ticket. TowConnect then arranges another way to send it. There is no need to spend an afternoon on it.
- Name the system and say roughly what is in it. The table names are not needed.

> TowConnect replies on the ticket when it is done. Check a few real records. TowConnect fixes anything that looks wrong. Every import TowConnect runs can be undone, exactly like one the business runs, and an undo keeps any record used since and names it.
