Показать сообщение отдельно
Старый 19.07.2012, 18:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
ax-erp: Get underlying SQL query using getSQLStatement [Dynamics AX 2012]
Источник: http://microsoft-dynamics-ax-erp.blo...ery-using.html
==============


Friends,
To get the underlying SQL query or statement from the X++ query, use getSQLStatement method. getSQLStatement is a new method that has been introduced in tables in AX 2012.
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.
staticvoid SR_getSQLStatement(Args _args)
{
CustTable custTable;
CustTrans custTrans;
;

selectgenerateonlyfirstOnly AccountNum, CustGroup
from custTable join custTrans where custTrans.AccountNum == custTable.AccountNum;

info(custTable.getSQLStatement());


}

Below is the SQL query.



Simple but very useful for developers for trouble shooting or to use it on reports.



Источник: http://microsoft-dynamics-ax-erp.blo...ery-using.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.