Update Reference/Foreign tables
Posted on 2007-10-08
Database: SQL Server2005.
I have Glossary table with bunch of Foreign Key relationship tables. Glossary table has some invalid data and same exists on the other relation tables.. Now in order to delete those invalid values out of Glossary i need remove them various other tables... so i wrote a update statement for each foreign key table(reference table) but that tidous process.. is there any way i can do this.. other than updating every single foreign key table..
For instance: TableA has foreign key relations with TableB,TableC, TableD..
Fields on TableA: UniqueID,Category,Description (UniqueID is a Primary Key on Table A and Foreign key table on TableB and also Foreign key table on TableC..) So i can't delete a UniqueID on TableA since the value exists on TableB, TableC.. So i want TableB & TableC to update with correct values and delete the invalid value from TableA but i dont want to write too many update queries..
Hope my question is clear! Let me know if you have any questions.
Need to know what's the best way to deal with this issue.