SQL statement appears to be truncated at around 4K length, as there's no definition for tables C (personDetails) and D (address). Variable personDetails appears to be for standard table ContactPerson. It looks like there are customizations and new fields on all four tables, as BBB_* are not standard fields in Dynamics AX 2009. Anyway, to me this looks like an issue with inefficient select query and SQL buffer overflow. I would try the following: Limit the number of fields that query returns, by specifying the field list in the select statement to those that are actually needed. The query in the sample code is way too wide, DirPartyTable is relatively small record, but returning full CustTable + ContactPerson + Address + custom fields is possibly causing buffer overflows; Instead of that outer join on Address, I would look at dropping that from the select, and then use Address::find() in the while select loop. Or optimize the whole query and use the address framework properly; Increase the buffer size on your AX server configuration. In Dynamics AX Server Configuration Utility, increase the Maximum buffer size option and restart the AOS. Default is 24 (KB), so try e.g. with 64 and see how it goes. Note that this might help with eliminating the errors due to buffer overflows, but performance will be poor with too many fields in select.
↧