Quantcast
Channel: Microsoft Dynamics Ax
Viewing all articles
Browse latest Browse all 181

How to delete or truncate all transaction from table

$
0
0
Sometimes it's take long time when you delete record with the instruction MyTable.delete() or Delete_From My Table.

Then it is better to delete from SQL instruction.

For that you can create one class and put this method in.

static server void ClearTable(str _tablename)
{
    SqlDataDictionary   sqlDict;
    
    if(!tableName2Id(_tablename))
        return;
    sqlDict = new SqlDataDictionary() ;
    new SqlDataDictionaryPermission(methodstr(SqlDataDictionary, tableTruncate)).assert();
    sqlDict.tableTruncate(tableName2Id(_tablename),false);
    CodeAccessPermission::revertAssert();
}

then enjoy!

Viewing all articles
Browse latest Browse all 181

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>