Формируем запрос, который хотим публиковать в MariaDB.
В SQL Server Profiler смотрим получившийся запрос.
Смотрим подсказку https://mariadb.com/kb/en/library/connect-odbc-table-type-accessing-tables-from-another-dbms/
Полученный запрос используем в создании виртуальной таблицы на MariaDB
create table `TovarAvailable`
COLLATE='cp1251_bin'
engine=CONNECT
table_type=ODBC
CONNECTION='Driver=SQL Server Native Client 10.0;Server=localhost;Database=UT3;UID=UUU;PWD=PPP'
SRCDEF='SELECT T3._Description AS tovar,
T4._Description AS characteristic,
T5._Description AS warehouse,
T1.Fld22666Balance_ AS available,
T1.Fld22667Balance_ AS shipment
FROM (SELECT _Fld22660RRef AS Fld22660RRef,
_Fld22663RRef AS Fld22663RRef,
_Fld22661RRef AS Fld22661RRef,
CAST(SUM(_Fld22666) AS NUMERIC(32, 8)) AS Fld22666Balance_,
CAST(SUM(_Fld22667) AS NUMERIC(32, 8)) AS Fld22667Balance_
FROM UT3.dbo._AccumRgT22669 AS T2
WHERE (_Fld954 = 0) AND (_Period = \'5999-11-01 00:00:00\') AND (_Fld22666 <> 0) AND (_Fld22666 <> 0) OR
(_Fld954 = 0) AND (_Period = \'5999-11-01 00:00:00\') AND (_Fld22666 <> 0) AND (_Fld22667 <> 0) OR
(_Fld954 = 0) AND (_Period = \'5999-11-01 00:00:00\') AND (_Fld22666 <> 0) AND (_Fld22667 <> 0) OR
(_Fld954 = 0) AND (_Period = \'5999-11-01 00:00:00\') AND (_Fld22667 <> 0) AND (_Fld22667 <> 0)
GROUP BY _Fld22660RRef, _Fld22663RRef, _Fld22661RRef
HAVING (CAST(SUM(_Fld22666) AS NUMERIC(32, 8)) <> 0.0) OR
(CAST(SUM(_Fld22667) AS NUMERIC(32, 8)) <> 0.0)) AS T1 LEFT OUTER JOIN
UT3.dbo._Reference169 AS T3 ON T1.Fld22660RRef = T3._IDRRef AND T3._Fld954 = 0 LEFT OUTER JOIN
UT3.dbo._Reference318 AS T4 ON T1.Fld22661RRef = T4._IDRRef AND T4._Fld954 = 0 LEFT OUTER JOIN
UT3.dbo._Reference267 AS T5 ON T1.Fld22663RRef = T5._IDRRef AND T5._Fld954 = 0';
Проверяем что получилось.
SELECT * FROM TovarAvailable
Можно на стороне MSSQL создать view на основе полученного запроса и предоставить доступ к нему. В этом случае мы не показываем параметры авторизации и структуру таблиц коллегам разработчикам.
Таким образом минимальными средствами выводим, например, справочник на сайте.
В примере использовались:
Управление торговлей, редакция 11 (11.3.2.207)
1С:Предприятие 8.3 (8.3.9.2309)
Microsoft SQL Server Standard Edition (64-bit) 10.50.6529.0
MariaDB 10.4.8