How to get the size and #records of the temporary tables in Dynamics AX ?

Sometimes, you need to the size and #records of retrieving data from temporary table to optimize your query

you can not get this information from SQL server because SQL server retrieves regular table type only.If your table type is inmemory or temdb , you can not show it in SQL server.

AX  can do this job easily,  sysdictable class  calculate number of records and size of records

just call these methods in the following job

static void tableSize(Args _args)
{

SysDictTable dict;
;
dict = new SysDictTable(tablenum(EmpTable));

info(strfmt(' record of table %1  size: %2',dict.name(),num2str(dict.recordSize(),0,0,1,0)));
 
info(strfmt('Table %1 has %2 records',dict.name(),int2str(dict.recordCount())));
}

Comments

Post a Comment