How to insert tableid using Insert_recordset. Its work on latest version of dynamics ax only.
int tab2 = tableNum(Table2);
insert_recordset TABLE(RefRecId, RefTableId) select recId, tab2 from Table2
Syntax..
insert_recordset NameOfTable(field1, field2,field3,field4,field5)
select field1, field2,field3,field4,field5
from RecOfTable
where Concolm<=299999;
//In SQL you can execute this way to work faster.
SELECT * INTO table2 FROM table1;