Sunday, February 12, 2012

best way to get metadata

I have a query that gets the tables, columns, indexes, index_columns for all tables in a data base.

But, I need to be able to select any data base on the server
and then drill down into the tables, columns, etc.

I looked at sys.databases but can't see how to relate that to the
sys.tables to extend my query.

Is there a way?

I've looked at the information_schema area and catalog views
but I don't see a solution yet.

I have a query that gets the tables, columns, indexes, index_columns for all tables in a data base.

But, I need to be able to select any data base on the server
and then drill down into the tables, columns, etc.

I looked at sys.databases but can't see how to relate that to the
sys.tables to extend my query.

Is there a way?

I've looked at the information_schema area and catalog views
but I don't see a solution yet.

|||Using three-parts names, add the database name to the object, e.g., Northwind.sys.tables.|||

Being in the database you want to inspect use the

sys.tables
sys.all_columns
sys.indexes
sys.index_columns

The information schema will provide you with most of the object you want to inspect but is not suitable for the used indexes.

Jens K. Suessmeyer.

http://www.sqlserver2005.de
--

|||

This has been answered in your identical post here.

It is best to not 'multi-post' like this. Post in one forum and wait for a response. That shows respect for the folks here since they don't have to spend time answering a question that was answered in another forum.

|||sorry for the multi-post but I thought maybe it was the wrong
forum to start with

No comments:

Post a Comment