views:

9

answers:

1

Hi, data mapping exercise approaches (3000+ tables) and I can get table names out (thanks to previous Stack Overflow answer) but is there easy way to get all table & view names and their associated columns, ideally with foreign and primary keys noted? Newbie here so answers need to be be very simple please! Many thanks, Jules.

A: 

You can query information_schema.view_column_usage to see what tables and columns are used by a view. Then query back to the other data that you have already pulled to see the primary and foreign keys.

select * from information_schema.view_column_usage
mrdenny
Thanks very much, but I think I'm going to steer as far away from views as I can when migrating data to the new software! Cheers, Jules
Jules
Usually there isn't much need for views, especially if you are using an ORM.
mrdenny