The following queries need to be executed on the production AppXtender(AX) SQL Server and it is strongly recommended to make sure you have a database backup before performing any database activities are performed. Also, as we are going to run SQL Count commands, consider the production system impact and perhaps run them outside of business hours.
The AX App Table Structures
All AX apps have an appid which is referenced throughout the database. All the appid is stored in the ae_apps table. The following screenshot is what the AX Demo database looks like:
The above table shows the relationship between the appid and the dtname (the document related information) and the dlname (the document page related information). For example, the AP application has an appid of 101 and the document table is ae_dt101 and the page table is ae_dl101. Therefore to count number of documents and pages you would use the following queries:
Adding Query Conditions
If you query the document table (ae_dt101 in the above example) you will notice that the column names are generically named as shown below:
Query the ae_adefs table to understand what the column names translate to: