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

Notifications

Announcements

No record found.

Community site session details

Community site session details

Session Id :
Microsoft Dynamics CRM (Archived)

Convert Fetch XML to SQL Query

(0) ShareShare
ReportReport
Posted on by

Is there a way to convert fetch xml to sql query?

 

- <fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
- <entity name="orbus_graphicsproductionsheet">
<attribute name="orbus_graphicsproductionsheetid" />
<attribute name="orbus_name" />
<attribute name="createdon" />
<attribute name="orbus_originalsalesorderid" />
<attribute name="ehtc_shipdate" />
<attribute name="orbus_taskstage" />
<attribute name="orbus_stageaction" />
<order attribute="ehtc_shipdate" descending="true" />
<order attribute="createdon" descending="false" />
- <filter type="and">
<condition attribute="createdon" operator="this-year" />
</filter>
- <link-entity name="salesorder" from="salesorderid" to="orbus_originalsalesorderid" alias="aa">
- <filter type="and">
<condition attribute="ehtc_productionsheetid" operator="null" />
</filter>
</link-entity>
</entity>
</fetch>

*This post is locked for comments

I have the same question (0)
  • Mathieu L Profile Picture
    100 on at

    Hi Nicole,

    You can use SQL Profiler to catch the SQL query.

    - Launch SQL Profiler

    - Execute your fetch XML query (Advanced find or view execution)

    - Search a particular term in the profiler results to find the line

    - SQL Profiler give you the exact query (with parameters)

  • Verified answer
    Mahadeo Matre Profile Picture
    17,021 on at

    Hi..

    best option is to get SQL is to use SQL profiler, if you are using on-premise CRM.

    your query will be look like

    select orbus_graphicsproductionsheetid

    , orbus_name

    , createdon

    , orbus_originalsalesorderid

    , ehtc_shipdate

    , orbus_taskstage

    , orbus_stageaction

    from orbus_graphicsproductionsheet

    inner join salesorder

    on orbus_graphicsproductionsheet.orbus_originalsalesorderid= salesorder.salesorderid

    where

    createdon >= DATEADD(yy, DATEDIFF(yy,0,getdate()), 0)

    and ehtc_productionsheetid is not null

    order by ehtc_shipdate desc, createdon asc

    and here is more information on to get query..

    inogic.com/.../use-sql-tracing-to-find-the-sql-query-generated-for-dynamics-crm-platform-operations-for-crm-on-premise

    stackoverflow.com/.../convert-fetchxml-to-sql-temp-table

    Hope this will work..

  • Community Member Profile Picture
    on at

    Hi ,

    Will it work for Dynamics CRM online?

  • suresh maurya Profile Picture
    630 on at

    For testing of FetchXML, you can test here online http://msxrmtools.com

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…

Neeraj Kumar – Community Spotlight

We are honored to recognize Neeraj Kumar as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics CRM (Archived)

#1
SA-08121319-0 Profile Picture

SA-08121319-0 4

#1
Calum MacFarlane Profile Picture

Calum MacFarlane 4

#3
Alex Fun Wei Jie Profile Picture

Alex Fun Wei Jie 2

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans