Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Delete all but top 100 rows
Message
De
15/05/2014 10:34:08
 
 
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Versions des environnements
SQL Server:
SQL Server 2008
Application:
Web
Divers
Thread ID:
01600029
Message ID:
01600032
Vues:
48
>>HI
>>
>>Whats the easiest way to delete all but the top 100 rows from a table.
>>
>>I'm testing somehting but I don't want to shove tens of thousands of records through it yet.
>>
>>Thanks
>>
>>Nick
>
>The simplest way will be (assuming you can truncate the table)
>
>select top (100) * into #SaveResults from TableToClean order by SomeColumn
>truncate table TableToClean
>insert into TableToClean
>select * from #SaveResults
>drop table #SaveResults
Thanks Naomi

having a brain dead afternoon I decided to delete all but 100 rows as it really didn't matter what I kept.

Nick
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform