Export data to database?

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 :slight_smile:



You would have the overhead of the XML to process, so the easiest way would be to create CSV file(s) and import them methinks.


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.

'PRAGMA foreign_keys=OFF;'
'CREATE TABLE tbl1(Title varchar(20), Track smallint);'
'INSERT INTO "tbl1" VALUES("'%TITLE%'"',$if2(%TRACK%,0)');'$loopend()

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
Lovin' You [Europe / Oz 4 Trk]/Europe / Oz 4 Trk|0
Song Name - Adele - Album|1

Hope this points you into the right direction.