web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

No record found.

News and Announcements icon
Community site session details

Community site session details

Session Id :

Check the SQL statement generated from a regular X++ select statement

PA-22040759-0 Profile Picture PA-22040759-0 6,194
So here is another small tip based on me reading Inside Microsoft Dynamics AX 2012 R3.

If you want to know what SQL statement the SQL Server query processor generates based on a regular X++ select statement, you can add to the keyord generateOnly to the statement an afterwards call the getSQLStatement method on the record buffer.

Example:
   AccountingEvent         accountingEvent;
   SourceDocumentHeader sourceDocumentHeader;

   select generateonly accountingEvent
   join sourceDocumentHeader
    where sourceDocumentHeader.RecId == accountingEvent.SourceDocumentHeader;

   info (accountingEvent.getSQLStatement());

That turns out something like this:


Comments

*This post is locked for comments