SELECT         
       ds.DataSourceName,
       lower(hex(t.DataSourceId)) as DataSourceID,
       t.SchemaName,
       t.TableName,
       lower(hex(t.TableId))as TableID,
       t.ExtendedPropertiesXML
  FROM DataSourceMetaStructures t
  Left Join
(
SELECT hex(ds.id) as DataSourceID, ds.Name as DataSourceName 
FROM DataSourceVersions ds
WHERE ds.VersionNumber = 
  (SELECT max(VersionNumber) FROM DataSourceVersions b WHERE b.id = ds.id)
  AND isTombStoned <> 1
) as ds
ON ds.DataSourceID=hex(t.DataSourceID)
Order By ds.DataSourceName, t.SchemaName, t.TableName