Quantcast
Channel: Microsoft Dynamics AX Forum - Recent Threads
Viewing all articles
Browse latest Browse all 72043

delete records from the very heavy table

$
0
0

Hello,

I need to delete records from the table which contains more than 24 million records. I need to delete them based on the created date time field. I used delete_record and there is an index on the filed  "created date time" but anyway it takes too much time. I checked then in SQL management studio that it doesn't fall to record level deleting row by row. It is still delete_from command on the SQL server and doesn't turn into while select{delete}is there any chance to somehow delete records using order by and only first 10 thousand using AX?

Or I need to write direct SQL statement?

something like this

WITH MyCTE AS (
    SELECT TOP (10) * 
    FROM SalesOrderDetail
    ORDER BY SalesOrderID DESC)
DELETE FROM MyCTE;

thanks.


Viewing all articles
Browse latest Browse all 72043


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