Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Determine Table Columns Associated with View Columns

Status
Not open for further replies.

grnzbra

Programmer
Mar 12, 2002
1,273
US
If I want to know the columns associated with a table, I can do a join on the sys.tables and sys.columns tables
If I wnnt to know the columns associated witn a view, I can do a join on the sys.views and sys.columns tables.
In both cases, I would join on object_id.
If a column appears in a view, it has two records in the sys.columns table - one with an object_id for the view and one with a different object_id for the table.
Is there any table that joins tables and views so that I might determine the underlying tables in a view?
 
Can’t you just look at the script of the view [ponder]

---- Andy

"Hmm...they have the internet on computers now"--Homer Simpson
 
This is for a script that compares one set of table/views with another set of table/views.
 
Something like this? (I'm brand new to SQL and don't know much, I barely even know the basics)

SELECT DISTINCT * FROM category here;

Sincerely,
Bob Space
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top