Monday, March 12, 2012

list Primary and foreign keys

I have a DB with 100 tables. I was wondering if anybody knows a quick way to list primary and foreign key with the column name for all the tables.

Your help would make my life a lot easier

thanks

In 2005 you can simple perform the following query.

SELECT * FROM INFORMATION_SCHEMA.TABLE_CONSTRAINTS

There are a whole bunch of other system views that display similar information.

Larry Pope

No comments:

Post a Comment