Wrong SQL displayed for C/AL Code in some cases


I have see situations, where there is wrong SQL statement displayed for e.g. FINDSET C/AL command. It looks like situations when the object is loaded from the DB first. Instead the SELEC over data the SELECT for the object is displayed. See the screenshot attachement taken from Sales order Posting...

file attachments

Closed Mar 5, 2015 at 7:29 PM by dwortho


dmytrositnik wrote Nov 26, 2013 at 12:30 PM

The FINDFIRST operation was executed on the temp record so there should not be any SQL query which directly corresponds to it.
But in some cases server issues queries to metadata tables. For example if the record is accessed very first time. Metadata caches can be invalidated in this case server will re-fetch the metadata. In the trace from your screenshot FINDFIRST call caused metadata query, that is why metadata query is mapped to the FINDFIRST call.

kine wrote Nov 27, 2013 at 7:23 AM

Ok, thanks, than it is my wrong understanding of the result. In case, when the FINDFIRST will be over real data, will be there mapped both queries? For data and for metadata? If yes, than it is ok.

Thanks for explanation and thanks for the tool!

dmytrositnik wrote Nov 27, 2013 at 2:19 PM

Yes, you should see SQL queries for metadata and data.

wrote Apr 30, 2014 at 9:52 AM

wrote Mar 5, 2015 at 7:29 PM