Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- DELETE FROM Table WHERE ID NOT IN (SELECT TOP 10 ID FROM Table)
- DELETE FROM Table WHERE ID NOT IN (SELECT TOP 10 ID FROM Table)
- create table #nuke(NukeID int)
- insert into #nuke(Nuke) select top 1000 id from article
- delete article where not exists (select 1 from nuke where Nukeid = id)
- drop table #nuke
- DELETE FROM table
- WHERE id NOT IN (SELECT id FROM table ORDER BY id LIMIT n);
- DELETE
- Product
- FROM
- Product
- LEFT OUTER JOIN
- (
- SELECT TOP 10
- Product.id
- FROM
- Product
- ) TopProducts ON Product.id = TopProducts.id
- WHERE
- TopProducts.id IS NULL
- declare @n int
- SET @n = SELECT Count(*) FROM dTABLE;
- DELETE TOP (@n - 10 ) FROM dTable
- DELETE TOP 90 PERCENT FROM dTABLE;
- Delete article where id not in (select top 1000 id from article)
- Delete a From Table a Inner Join (
- Select Top (Select Count(tableID) From Table) - 10)
- From Table Order By tableID Desc
- ) b On b.tableID = A.tableID
- WITH CTE AS
- (
- SELECT ID
- FROM dbo.TableName
- ORDER BY ID DESC
- OFFSET 11 ROWS
- )
- DELETE CTE;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement