Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to propagate new keys to child table
Message
 
 
À
22/05/2009 12:05:17
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Scripting
Versions des environnements
SQL Server:
SQL Server 2005
Application:
Web
Divers
Thread ID:
01401548
Message ID:
01401550
Vues:
51
This message has been marked as the solution to the initial question of the thread.
>I'm trying to refactor a poor DB design that has resulted in many duplicate rows. (about 80,000 rows out of 190,000 rows are dupes.
>I understand how to delete the duplicates, but I am unsure how to propogate the PK of the rows I keep to children of the duplicates, IOW I'm trying to map 1 onto many.
>
>Am I making any sense?
>
>Thanks for any ideas.

Should the PK become FK for the child table? What exactly is the problem here?

I think I got the problem now. You need to re-map all the children of the original duplicate records you deleted to the IDs which are left as unique.

Sounds to me you need to use temp table with the original IDs and the ID of the records which are left and then re-map everything.
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