Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Deleting Duplicates
Message
 
 
À
15/02/2013 16:04:18
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Syntaxe SQL
Divers
Thread ID:
01566185
Message ID:
01566190
Vues:
40
>OK, here's my ever so often dumb Friday afternoon question.
>
>I ran the Sedna upsizing wizard to upsize a VFP database to SQL Server 2012 and it managed to create duplicate records, so I now need to delete those that are duplicates. There are only a few of them so I was going to manually do it in SSMS, but of course that won't work because there is no way to uniquely identify the record I am trying to delete.
>
>Any suggestions on how to do this?

Did you create complete duplicates or some fields are different?

You may try:
;with cte as (select *, row_number() over (partition by Column1, Column2, Column3 order by Column1) as Rn
from TableWithDups)

delete from cte where Rn > 1
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform