How to view the foreign key settings within a database administered using MyLittleAdmin?
Looking to find information about foreign keys between tables, via the control panel for a website I was using MyLittleAdmin to manage the associated database.
I was able to view the keys associated with a particular table but unlike the SQL Management Studio this didn’t allow for key review.
I looked to using t-sql and found this
SELECT fk.name AS ForeignKey, OBJECT_NAME(fk.parent_object_id) AS FkTable, COL_NAME(fkc.parent_object_id, fkc.parent_column_id) AS FkColumn, OBJECT_NAME(fk.referenced_object_id) AS ReferencedTable, COL_NAME(fkc.referenced_object_id, fkc.referenced_column_id) AS ReferencedColumn, delete_referential_action_desc AS OnDelete, update_referential_action_desc AS OnUpdate FROM sys.foreign_keys AS fk INNER JOIN sys.foreign_key_columns AS fkc ON fk.object_id = fkc.constraint_object_id WHERE fk.parent_object_id = OBJECT_ID('OurStuff');
By changing the table reference I was able to get the list of keys and their settings.