I want to select the last 5 records from a table in SQL Server without arranging the table in ascending or descending order.
Get the count of that table
select count(*) from TABLE select top count * from TABLE where 'primary key row' NOT IN (select top (count-5) 'primary key row' from TABLE)