Please explain this delete top 100 SQL syntax
- by Patrick
Basically I want to do this:
delete top( 100 ) from table order by id asc
but MS SQL doesn't allow order in this position
The common solution seems to be this:
DELETE table WHERE id IN(SELECT TOP (100) id FROM table ORDER BY id asc)
But I also found this method here:
delete table from (select top (100) * from table order by id asc) table
…