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

Announcements

No record found.

News and Announcements icon
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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Stars!

Meet the Microsoft Dynamics 365 Contact Center Champions

We are thrilled to have these Champions in our Community!

Congratulations to the March Top 10 Community Leaders

These are the community rock stars!

Leaderboard > Customer experience | Sales, Customer Insights, CRM

#1
ManoVerse Profile Picture

ManoVerse 196 Super User 2026 Season 1

#2
11manish Profile Picture

11manish 129

#3
CU11031447-0 Profile Picture

CU11031447-0 100

Last 30 days Overall leaderboard

Product updates

Dynamics 365 release plans