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

getting fields of tables

Status
Not open for further replies.

dky1e

Programmer
May 4, 2002
293
US
I want to read in all table names and the servers they are located on for which a specified column exists.

For example for tables
table: server.a col: a, b, c
table: server.b col: a, e, g
table: server2.d col: x,y
table: server2.e col: a, e

I want to get all the table names and servers that have a column 'a': server.a, server.b, server2.e

Thanks. You have been most helpful.
 
IN psudo-code, here is one way to do this:
1) create a table with all the servers and their databases you want to check on one server
2) create linked servers to each.
3) build cursor on server table, running query that will join target server's sysobjects table to syscolumns table on ID column where syscolumns.name = the column name you are looking for.

good luck!
 
awesome! I can't mark it as helpful for some reason.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top