views:

45

answers:

2

I have a large database with over 150 tables that I've recently been handed. I'm just wondering if there is an easy way to view all foreign key constraints for the entire DB instead of on a per-table basis.

+3  A: 

You can use the INFORMATION_SCHEMA tables for this. For example, the INFORMATION_SCHEMA TABLE_CONSTRAINTS table.

Something like this should do it:

select *
from INFORMATION_SCHEMA.TABLE_CONSTRAINTS
where CONSTRAINT_TYPE = 'FOREIGN KEY'
RedFilter
Looks like that has exactly what I need. Thanks!
Scott Wolf
A: 

you might want to check out http://schemaspy.sourceforge.net/

schema spy is a java command line utility to reverse engineer databases

house9