Skip to main content

Notifications

Announcements

No record found.

Microsoft Dynamics CRM (Archived)

running update SQL query on database

Posted on by Microsoft Employee

Hi

i have a requirement to append a custom field value in a custom entity to another field within the same entity.

the records are in thousands and i cannot run this using api. given i am only updating custom field of a custom entity

that too within same entity: is it ok to run a weekly over night schedule task to do this in SQL code?

any help is appreciated.

*This post is locked for comments

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: running update SQL query on database

    Hi Likki ,

    Doing any operation directly  in CRM Database is not a good practice  , so I would prefer to build console and using pagination retrieve more than 5000 records .

    You can check below reference how to retrieve more than 5k records .

    msdn.microsoft.com/.../gg328046.aspx

    docs.microsoft.com/.../page-large-result-sets-with-fetchxml

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: running update SQL query on database

    Hi Gautam

    the entity has 55000 items and would like to do with SQL stored procedure. any implications if i choose this path?

  • Suggested answer
    gdas Profile Picture
    gdas 50,085 on at
    RE: running update SQL query on database

    Hi Likki ,

    Please refer below old thread where I have shared how to write console and schedule the job in windows scheduler.

    community.dynamics.com/.../273478

    Hope this helps.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: running update SQL query on database

    hi Adrian could you tell about console application way to achieve this? I am thinking a console application to open SQL connection and execute a stored procedure? is this what you mean by console app?

    any help is much appreciated.

  • Suggested answer
    Adrian Begovich Profile Picture
    Adrian Begovich 21,009 Super User 2024 Season 2 on at
    RE: running update SQL query on database

    Hi Likki,

    You can do it, but consider SQL Server Integration Services (SSIS), Workflows, and C# Console Applications as alternative options.

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

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Tips for Writing Effective Suggested Answers

Best practices for providing successful forum answers ✍️

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,280 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,214 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Featured topics

Product updates

Dynamics 365 release plans