How to know if primary key is used as foreign key somewhere in database?
918207May 6 2012 — edited Aug 19 2012Hi,
So is there a way to check that? I need to make that check from the code and disable delete action from web client.
Table in question is join table which joins two entities, service provider and country. If service provider is assigned to some country and that record is referenced from some other tables in data base, delete action should be forbidden.
Table holds three columns
CID | SERVICE_PROVIDER_ID | COUNTRY_ID
1 | 5 | 7
2 | 5 | 9
3 | 5 | 2
4 | 3 | 7
5 | 3 | 9
So, CID is the key which is referenced from other tables and program should check if it's being referenced.
Thank you!