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 :
Microsoft Dynamics AX (Archived)

how to delete all records from table?

(0) ShareShare
ReportReport
Posted on by

I have a class's method to insert data from one table to another.

NOW

Data should be inserted only when the second table  is empty....if the second table is NOT empty , it should call a method to delete all records from that table and then insert the data. 

plz help

regards

rajesh

*This post is locked for comments

I have the same question (0)
  • Suggested answer
    Vilmos Kintera Profile Picture
    46,149 on at

    Why don't you call a truncate/delete on the table always, then you would have no records in there each time you try to insert?

  • AX 2012 r3 Profile Picture
    2,426 on at

    Table1  table1;

    table2 table2;

    select firstfast table2;  //Check for a record in table2..because 1st record is enough to check data is there or not

    if(!table2)

    {

    //Insert you logic

    }

    else

    {

    // Logic to delete Table 2

       ttsBegin;

       delete_from   table2;

       ttsCommit

    }

  • Martin Dráb Profile Picture
    239,118 Most Valuable Professional on at

    How do you all expect this to work in a multi-user environment? One user will start putting records to the table and another user will start the same process, deleting the data for everybody. This design seems to have significant flaws.

    I would return to the actual business requirement and build a different solution.

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 > 🔒一 Microsoft Dynamics AX (Archived)

#1
Basit Profile Picture

Basit 1

#1
GL-01081504-0 Profile Picture

GL-01081504-0 1

#1
Roya Profile Picture

Roya 1

Last 30 days Overall leaderboard

Featured topics

Product updates

Dynamics 365 release plans