I have searched a long time and still haven't found the answer to my problem.
Our Dynamics AX is generating queries with the query hint OPTION (FAST x), which sometimes forces a bad execution plan to be used. The devs say it is by default and is hard to change (has to be fixed on all forms potentially).
So I was after a way to override these hints using trace flags. I found the lovely trace flag 8722 which is claimed to make SQL Server ignore some query hints, especially the ones in the OPTION clause.
However, this doesn't work in my case. I tried to enable trace flag 8602 (disable index hints) as well, but my query is still running with the FAST x hint (it is much slower than when I actually remove the OPTION clause).
I tried to clear the plan cache as well, to no avail.
Any ideas? Am I missing anything?
P.S. I enabled the trace flags globally, this is SQL Server 2012 Developer edition