Memory Data sample

So I guess this is the problem, because at this point I insert the whole statement I attached.
I have to consider an alternative.

you can do it with

  Connection.NewCommand('INSERT ...',stSQL).Execute;

I thought a couple more approaches, like a memory table filled by a Dataset created by Schema.NewDataset(Connection, ‘ATableThatExecutesmySQL’), but this has the problem
that the client will request a Dataset with a different name, the one I firstly wanted to override its SQL.
How will the client get the results then since this code will be executed only when

if CompareText(aDataset.Name, ‘MyTable’) = 0 then

Probably, I can’t see whole problem, but you can return required data from server to client via custom methods like

function GetMyData(...): Binary;

on client-side, you can load data from this Binary to your table.

another solution: drop MemDatatable to _Impl, register it in daservice.ExportedDataTables.
you can fill data to this table manually or via LocalDataAdapter.
from client-side, this table will be usable as usual table