Get from X++ QUERY to get SQL query using getSQLStatement() for trouble shooting Dynamics AX 2012
getSQLStatement is a new method that has been introduced in tables in AX 2012. Use getSQLStatement() method to get the SQL query from the X++ query to use for trouble shooting.
The X++ select has been extended with the generateonly command that instructs the underlying data access framework to generate the SQL query without actually executing it.
Code Example:
static void getSQLQuery(Args _args)
{
CustTable custTable;
CustTrans custTrans;
select generateonly firstOnly AccountNum, CustGroup
from custTable join custTrans where custTrans.AccountNum == custTable.AccountNum;
info(custTable.getSQLStatement());
}
Comments
Post a Comment