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,...
Unanswered

is it possible to run SQL queries from a plugin?

(0) ShareShare
ReportReport
Posted on by

Hi,

how can I run SQL queries from within a custom plugin (or maybe if there is a plugin available able to doing this) when using Dynamics CRM 365?

I really mean custom SQL queries.

I want to setup a risk management system on top of my data in Dynamics, each risk will be evaluated using an SQL query and I want to create a plugin to evaluate this query and store the result in an entity.

why SQL?

because my risks can be complicated and required to cross multiple entities.

I tried to create a plugin connected to the TDS access point, but its not working because the adsql.dll library is missing.

is there any option?

I have the same question (0)
  • Community Member Profile Picture
    on at

    Hi,

    Recently Microsoft has released new product feature where we can directly connect to SQL and write query into CSD Database. Currently this is in preview and not recommended for Product environment.

    You can refer following links for more details:

    Use SQL to query data (Microsoft Dataverse) - Power Apps | Microsoft Docs

    Use SQL to Query Data from CDS and Dynamics 365 CE (powerobjects.com)

    Setting up – Using SQL to query data in Dynamics 365 (Preview) – Nishant Rana's Weblog

    Regards,

    Leah Ju

    Please mark as verified if the answer is helpful. Welcome to join hot discussions in Dynamics 365 Forums.

  • Jerome P1 Profile Picture
    on at

    thanks but my problem was how to access TDS from within a C# plugin.

    after a lot of research, I found that the problem is related to docker deployments, so the CRM appear to be in docker instances and not windows or linux ones.

    and the solution was to use the Microsoft.Data libraries and not the SqlServer librairies.

    but I hope microsoft will integrate a simple and direct access to the TDS end point.

  • Community Member Profile Picture
    on at

    Hi,

    For your final request, you can provide your ideas in following forum:

    experience.dynamics.com/.../

    Regards,

    Leah Ju

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 74 Super User 2025 Season 2

#2
Daniyal Khaleel Profile Picture

Daniyal Khaleel 32 Most Valuable Professional

#3
Gerardo Rentería García Profile Picture

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

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans