# Export data to database?

**URL:** https://community.mp3tag.de/t/export-data-to-database/9703
**Category:** Support
**Created:** [January 13, 2010, 11:45pm UTC](https://community.mp3tag.de/t/export-data-to-database/9703 "2010-01-13T23:45:55Z")
**Posts on this page:** 1
**Showing post:** 3

<div class="post-metadata">

### Author: ![DetlevD](https://community.mp3tag.de/user_avatar/community.mp3tag.de/detlevd/32/123_2.png) [@DetlevD](https://community.mp3tag.de/u/DetlevD)
#### Post date: [January 14, 2010, 9:22am UTC](https://community.mp3tag.de/t/export-data-to-database/9703/3 "2010-01-14T09:22:18Z")

</div>

> [@djatwork](#):
>
> Just wondering if it would be possible to export tag data directly into a, for example, MS SQL database? I am able to export an XML file, but I have not found an easy way to import XML to SQL, so I wanted to try and save a step :)Cheers,Drew

Well ... I think ... yes you can .. there is a way to SQL.

Since Mp3tag exports all data in text mode, you are able to write an export script which has the format of a SQL table dump. Afterwards you can create a SQL database from this dump file.  
There might be other possibilities to write a SQL insert script or such alike.

Here is an example Mp3tag export script.

```
$filename(F:\TEMP\Mp3tag.sql.txt,UTF-8)
'PRAGMA foreign_keys=OFF;'
'BEGIN TRANSACTION;'
'CREATE TABLE tbl1(Title varchar(20), Track smallint);'
$loop(%TITLE%)
'INSERT INTO "tbl1" VALUES("'%TITLE%'"',$if2(%TRACK%,0)');'$loopend()
'COMMIT;'

```

Using sqlite3.exe you can create a sql database from the Mp3tag export text file on the command line:

```
TYPE "F:\TEMP\Mp3tag.sql.txt"|sqlite3.exe TestDB

```

Some output on the command line looks like:

```
F:\TEMP>ECHO.select * from tbl1;|sqlite3.exe TestDB
abc def ghi (JKL mNo pQ) rst uvw xyz|11
Ambivalence Avenue|1
Daydreamer|1
Lovin' You [Europe / Oz 4 Trk]/Europe / Oz 4 Trk|0
Song Name - Adele - Album|1

```

Hope this points you into the right direction.

DD.20100114.1122.CET

---

_[View the full topic](https://community.mp3tag.de/t/export-data-to-database/9703)._
