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

Community site session details

Session Id :
Microsoft Dynamics AX (Archived)

X++ or SQL

(0) ShareShare
ReportReport
Posted on by

Hello guys,

I have to move some data from one field to another in the same table and also from one table to another.

And I was wondering which is the best way. Should I use X++ with the update_recordset and other such commands or is it better to do it directly with SQL from SQL Server Management Studio. Is there any difference at all? What is the best practice? 

Best Regards!

*This post is locked for comments

I have the same question (0)
  • Verified answer
    Martin Dráb Profile Picture
    236,118 Most Valuable Professional on at
    RE: X++ or SQL

    Do you want somebody to have direct access to production database and run some scripts there? The usual answer is "no", therefore people usually write data update scripts in X++, save them to version control together with other code and metadata (such as the new field into which you want to migrate the data) and test and deploy them in the same way as all other changes.

  • Verified answer
    Vilmos Kintera Profile Picture
    46,149 on at
    RE: X++ or SQL

    You cannot do this in SQL Server, AX maintains unique record identifiers (RecId and RecVersion) and many other fields from the kernel, which you cannot correctly generate using SQL.

    That means yes, you need to build the code in AX. If this is a repeat task, you could utilize the Data Export Import Framework where you would create a custom entity for this copy routine. If it is a one-off task, then just simply do it in a Job.

  • add Profile Picture
    on at
    RE: X++ or SQL

    I need to do it in production.

  • Martin Dráb Profile Picture
    236,118 Most Valuable Professional on at
    RE: X++ or SQL

    Are we talking just about some development environment, or do you need to do it in production?

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…

Andrés Arias – Community Spotlight

We are honored to recognize Andrés Arias as our Community Spotlight honoree for…

Leaderboard > 🔒一 Microsoft Dynamics AX (Archived)

#1
Community Member Profile Picture

Community Member 4

#2
Mea_ Profile Picture

Mea_ 2

#2
Martin Dráb Profile Picture

Martin Dráb 2 Most Valuable Professional

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans