Tag: sql server
-
sql server, find foreign keys associated with given primary key
If you work with an unknown schema and try to investigate the relationships between primary and foreign keys, there is a great answer on stackoverflow originally posted by db2. SELECT o1.name AS FK_table, c1.name AS FK_column, fk.name AS FK_name, o2.name AS PK_table, c2.name AS PK_column, pk.name AS PK_name, fk.delete_referential_action_desc AS Delete_Action, fk.update_referential_action_desc AS Update_Action FROM…