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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

Trace Parser SQL - Missing Quotes on ItemId and SalesId

(0) ShareShare
ReportReport
Posted on by 60

Hi,

I am using Trace Parser version 6.0.947.9033 to display information collected against AX 2009.

The SQL displayed by Trace Parser shows queries like this where SalesId is missing quotes around.

When I run this SQL it is very slow and is much faster when placing the quotes around salesid

like AND (((SALESID='42020666').

I will try and capture this SQL in the DB, but there is either a bug in the AX interpreter or the Trace Parser!!!

Any thoughts from the experts "

Thanks Jim

select a.recid

FROM CUSTCONFIRMTRANS A
WHERE ((DATAAREAID='vcc')
AND (((SALESID=42020666)
AND (CONFIRMID='C22988508'))
AND (CONFIRMDATE='2014-11-20')))

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Martin Dráb Profile Picture
    236,499 Most Valuable Professional on at
    RE: Trace Parser SQL - Missing Quotes on ItemId and SalesId

    I managed to reproduce your problem in Trace Parser (6.3.164.0), but I don't believe that the problem lies in AX.

    Your findings were surprising to me - as far as I know, the only correct value, and the one that AX actually uses, would be N'42020666'.

    Look at the following X++ code (for AX 2012):

    CustConfirmTrans a;
    select generateOnly forceLiterals RecId from a
        where a.SalesId == '4202666';
    info(a.getSqlStatement());

    It returns the following:

    SELECT T1.RECID FROM CUSTCONFIRMTRANS T1
    WHERE (... -- Partition and DataAreaId
    AND (SALESID=N'4202666'))
    

    You can't use the same piece of code in AX 2009, nevertheless you can use SQL Server Profiler or Extended Evens to see what AX really sends to database. I'm pretty sure you will find something similar.

    The query with a numeric value is so slow because SQL Server converts all Sales IDs in database to int (and if there is any non-numeric Sales ID, it will fail ("Conversion failed when converting nvarchar value 'xyz' to data type int").

    But as I mentioned above, I see the same problem in Trace Parser

    I believe that the problem is either in Trace Parser or in the way how trace data is collected. Either way, it's likely nothing that we can fix. You should report it to Microsoft and request a fix.

  • Jim Bonnie Profile Picture
    60 on at
    RE: Trace Parser SQL - Missing Quotes on ItemId and SalesId

    Thank you for confirming that you believe this is a Trace Parser issue.

    I was able to collect the SQL with profilier and see the correct Character paramater, so this is not an AX problem.

    I will report the problem to MSFT for them to investigate.

  • Jim Bonnie Profile Picture
    60 on at
    RE: Trace Parser SQL - Missing Quotes on ItemId and SalesId

    Thanks for your feedback.

    I have opened a ticket with MSFT to see if they can offer a fix for Trace Parser, I will post the results here.

  • James Chwaszczewski Profile Picture
    245 on at
    RE: Trace Parser SQL - Missing Quotes on ItemId and SalesId

    I'm seeing the same issue as I try to analyze queries.  Was there any fix for this?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Responsible AI policies

As AI tools become more common, we’re introducing a Responsible AI Use…

Abhilash Warrier – Community Spotlight

We are honored to recognize Abhilash Warrier as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Martin Tocauer Profile Picture

Martin Tocauer 4

#2
Community Member Profile Picture

Community Member 2

#2
Nayyar Siddiqi Profile Picture

Nayyar Siddiqi 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans