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 :
Customer experience | Sales, Customer Insights,...
Answered

Convert SQL Query to Query Expression

(0) ShareShare
ReportReport
Posted on by 55

Hi,

 I have a requirement where I have given a SQL query which I need to Convert into Query Expression which will be used for retrieval of records in console apps. 

Please find the query below:-

Select d.new_DepositNo,d.new_EmailID,d.new_MobileNumber,d.new_DepositStatus,d.new_PaymentType,d.new_BankName,d.new_ManAccountsDetails,w.new_WarAmt,w.new_WarDate

From new_depositmaster d With (nolock) Join new_mwarrants w On w.new_depnumber = d.new_DepositNo

Where d.new_DepositStatus = 'R' and d.new_PaymentType in ('RTGS','WARRANT') and cast(w.new_WarDate as date) = cast(GETDATE() as date)

Regards,

Shoaib Khan.

I have the same question (0)
  • Verified answer
    Guido Preite Profile Picture
    54,086 Moderator on at

    you can recreate the query using FetchXML Builder (you can find it inside XrmToolBox), after you tested the query and you see it works (you can preview the results) from the tool you can convert the FetchXML to Query Expression.

  • Verified answer
    Bipin D365 Profile Picture
    28,983 Moderator on at

    Hi,

    Use below link to generate your fetch XML code based on SQL query.

    http://sql2fetchxml.com/

  • Verified answer
    Community Member Profile Picture
    on at

    Hi ShoaibKhan,

    The tools provided by Guido Preite and Bipin Kumar are both viable.

    You can refer the following link to learn how to use them: 

    How to – Convert Fetch XML to SQL in Dynamics 365 – Nishant Rana's Weblog

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 > Customer experience | Sales, Customer Insights, CRM

#1
Tom_Gioielli Profile Picture

Tom_Gioielli 73 Super User 2025 Season 2

#2
Gerardo Rentería García Profile Picture

Gerardo Rentería Ga... 43 Most Valuable Professional

#3
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans