WordPress / Web Development Tutorials
(Best WordPress Tutorials)

CSSHTMLJavaScriptjQueryMySQLPHPSilvaTechnologiesWooCommerceWordpress
Silva Web Designs - Blog

How to delete the top ‘X’ rows from a table using SQL Server 2008?

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.

 

Nathan da Silva - Profile

Posted by: Nathan da Silva

Nathan is the Founder of Silva Web Designs. He is passionate about web development, website design and basically anything digital-related. His main expertise is with WordPress and various other CMS frameworks. If you need responsive design, SEO, speed optimisation or anything else in the world of digital, you can contact Silva Web Designs here; [email protected]

It’s good to share

Join the discussion

Related Posts

HTML / 25th November 2014

How to recover SQL Server database from suspect mode?

Read More