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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Searching Facility

Status
Not open for further replies.
Jun 12, 2009
123
GB
Hi All,

I am using SQL 2008 R2 and I have a table with a lookup field. The lookup field must connect to another table and rather than go through the 100+ tables is there a search facility which can show me which other tables hold this field? Or a sql script?

Many Thanks
 
You can get a list of tables and the columns in the table by using the information_schema view. Like this:

Code:
Select Table_Name, Column_Name
From   information_schema.Columns
Order By Table_Name, Column_Name

There's other stuff in information_schema.columns that you may find interesting, like the data type, max lengths, etc...


-George
Microsoft SQL Server MVP
My Blogs
SQLCop
"The great things about standards is that there are so many to choose from." - Fortune Cookie Wisdom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top