I think you're right concerning BASIC_METADATA. If I understand you correctly you cannot read the CONTENT column containing XML properly. The reason is that the XML strings are shown in hex code.
In SQL Server the column has a rather old datatype (IMAGE) you cannot handle very well. As I see it, you have to convert the CONTENT column to VARBINARY and then to VARCHAR (but perhaps there is a more elegant solution):
SELECT CONVERT( VARCHAR(256), CONVERT (VARBINARY(MAX), CONTENT))
FROM BASIC_METADATA
WHERE TYPE = 'OpDevice'
Then you have the XML representations of the Hardware devices which of course you have to parse. I'm sure there is a more straightforward solution in SQL Server to get the values you want directly , but I'm not a SQL Server pundit.
If you are using the embedded database, open the dbisqlc.exe tool and run the following command:
SELECT CONVERT( VARCHAR , CONTENT) FROM BASIC_METADATA
WHERE TYPE = 'OpDevice' ;
OUTPUT TO C:\output.txt;
Here it's possible to convert directly to VARCHAR. The result will be written in the file 'C:\output.txt'. dbisqlc does not need a conversion at all to show the XML data in its window but if you want to export through OUTPUT you have to convert to VARCHAR.
In the XML data, device IDs are called "DeviceInstanceId" and class IDs "DeviceClassGuid".
HTH!