Recently we were confronted with a case where we received the following SQL error:
This error occurs if we are running into a SQL limitation which does not allow more than 2100 parameters in a SQL statement.
Usually it's a Select statement where AX produces OR clauses with too many parameters like
or IN clauses like
How to find where this select statements are comming from?
In the SQL statement trace log (Administration -> Inquiries - Tab 'Use') you will find the stack trace that shows you which method caused the SQL error.
How to fix this problem?
We have to add a forceliterals to the select statement in the relevant method.
Adding a forceliterals should avoid running into the SQL limitation of the 2100 parameters, because the statement is handled differently then.
The related statement could either be an X++ select stament or a X++ Query
Change code from
Activate forceliterals on the Query object