To delete the top ‘X’ rows from a table using SQL Server 2008 / MSSQL for specific ordering criteria deleting from a CTE or similar table expression is the most efficient way.
This can be achieved as follows:-
;WITH CTE AS ( SELECT TOP 1000 * FROM [mytable] ORDER BY a1 ) DELETE FROM CTE
We hope this has helped, feel free to check out other blogs for tutorial and helpful tips when it comes to the digital world. Have a project in mind? Awesome, get in touch with our team for assistance.