user2734217
user2734217

Reputation: 121

how to locate a column in other tables

I have just loaded some tables to our main db. there is a col in one table called MAPCONCEPTID. the schema is OPTC and prefix is SNO

the boss is asking me where is this mapped to? which other table that uses this col. it apparently is very important col.

Want to know how to find where MAPCONCEPTID field in one of your table is mapped to

Upvotes: 0

Views: 41

Answers (2)

AHiggins
AHiggins

Reputation: 7219

This is what I would do to start with: this has the advantage of not relying on correctly mapped dependencies and keys, but the MAJOR disadvantage of relying on the column in the other table being named the same thing. It might work for you.

SELECT TABLE_SCHEMA, TABLE_NAME, COLUMN_NAME, ORDINAL_POSITION, DATA_TYPE
FROM INFORMATION_SCHEMA.COLUMNS
WHERE 
    COLUMN_NAME = 'MAPCONCEPTID' AND -- Your Column Name
    TABLE_SCHEMA = 'OPTC' AND -- Your Schema (optional)
    TABLE_NAME != '' -- Exclude the starting table

Upvotes: 0

Pradeep Kumar
Pradeep Kumar

Reputation: 6979

In SQL Server Management Studio, expand the Tables node in Object Explorer window. Locate your table. Then right-click on it and select View Dependencies from the popup menu.

enter image description here

This will open the Object Dependencies window. Use this window to find what other tables it is dependent upon, or what other tables depend on this table.

enter image description here

Upvotes: 1

Related Questions