📖
SQL to FetchXML Query Converter Guide
Convert standard relational SQL SELECT statements into Microsoft Dynamics 365, CRM, and Microsoft Dataverse FetchXML format. Simplify complex FetchXML XML construction by writing simple SQL.
🔒Technical Specifications & Local Processing Architecture
Uses an AST-like SQL parser that breaks down target entities, project attributes, condition operators, and linked entity structures to map them dynamically to W3C-compliant CRM XML attributes.
✨ Core Capabilities
- •Parses basic SQL SELECT, JOIN, WHERE, and ORDER BY clauses.
- •Converts relational inner/left JOINs into nested FetchXML <link-entity> nodes.
- •Translates conditional operators (=, <>, IN, LIKE, IS NULL, BETWEEN) to standard FetchXML filters.
- •Outputs formatted, clean, and indented XML structure with 1-click clipboard copy.
🚀 Step-by-Step Guide
- 1. Write or paste your SQL SELECT query in the SQL Input panel.
- 2. The parser automatically processes the query and generates the FetchXML code in the right panel.
- 3. If any parsing error occurs, correct the SQL query based on the warning indicators.
- 4. Copy the formatted FetchXML and paste it directly into your Dynamics 365 developer tool or C# WebAPI plugin.
🔬Verified Input & Output Examples (Before / After)
1SQL SELECT Query to Dynamics 365 FetchXML with JOIN
Converts relational SQL queries with INNER JOIN and WHERE filters into standard Microsoft Dataverse FetchXML format.
📥 SQL SELECT Query (Before)
SELECT contact.fullname, contact.emailaddress1, account.name FROM contact INNER JOIN account ON contact.accountid = account.accountid WHERE contact.statecode = 0 AND account.statuscode = 1 ORDER BY contact.createdon DESC
📤 Generated FetchXML (After)
<fetch mapping="logical" version="1.0">
<entity name="contact">
<attribute name="fullname" />
<attribute name="emailaddress1" />
<filter type="and">
<condition attribute="statecode" operator="eq" value="0" />
</filter>
<order attribute="createdon" descending="true" />
<link-entity name="account" from="accountid" to="accountid" link-type="inner">
<attribute name="name" />
<filter type="and">
<condition attribute="statuscode" operator="eq" value="1" />
</filter>
</link-entity>
</entity>
</fetch>