How to Delete top 5 rows from a table

You will need to be able to order the data in some way.

Say you have a table T storing people birthdays with two following columns: personId, birthdayDate.

To delete 5 top rows from that table you could do

delete from T 
where personId in (select top 5 personId from T order by personId)

I don't know if there is a better way of doing this.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.