Wednesday, 4 January 2017

Delete top N records from a table

With the help of below sql script we can delete top n record from a table.
  Delete top (1) FROM [Test].[dbo].[Employee]


 
One record is deleted successfully.

Using CTE


  with  temp as
  (
   select top 5 * from [test].[dbo].[employee]
   order by 1 asc
  )
  delete from temp


  

Popular Posts