Solved

How delete all recods not in top 40

Posted on 2014-01-29
3
287 Views
Last Modified: 2014-01-29
Deat all,
How delete all recods not in top 40
delete NewsSYSNewsTags where @@ROWCOUNT>40 and NewsID=@NewsID order by WordWeight desc
0
Comment
Question by:ethar1
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 15

Expert Comment

by:David L. Hansen
ID: 39818247
When you say "Top 40" to you mean by ranking (like the top 40 highest net worth) or just the first 40 records entered into the table?
0
 
LVL 65

Accepted Solution

by:
Jim Horn earned 500 total points
ID: 39818249
Air code.  I do my own stunts too..

DELETE FROM NewsSYSNewsTags
WHERE NewsID NOT IN (
   SELECT TOP 40 NewsID FROM NewsSYSNewsTags ORDER BY WordWeight DESC)
0
 

Author Comment

by:ethar1
ID: 39818489
0

Featured Post

Is Your DevOps Pipeline Leaking?

Is your CI/CD pipeline a hodge-podge of randomly connected tools? You’ve likely got a tool to fix one problem & then a different tool to fix another, resulting in a cluster of tools with overlapping functionality. Learn how to optimize your pipeline with Gartner's recommendations

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
A Stored Procedure in Microsoft SQL Server is a powerful feature that it can be used to execute the Data Manipulation Language (DML) or Data Definition Language (DDL). Depending on business requirements, a single Stored Procedure can return differe…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question