Search code examples
dynamics-ax-2012axdynamics-ax-2012-r2

Truncate table via web service


Hi does anybody know if its possible to truncate a staging table via a web service in AX 2012? There is the delete method, however this is a bit slow for a large number of records.


Solution

  • For anyone who is struggling with this. I created a new method (class and operation) in my web service and exposed this, to delete all records from a table. The following code was used:

    [SysEntryPointAttribute(true)]
    public void truncateTable()
    {
        TableNameHere tableNameHere;
        ;
        ttsBegin;
        delete_from tableNameHere;
        ttsCommit;
    }