Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2008 Forums
 SQL Server Administration (2008)
 Find related tables by searching for a column name

Author  Topic 

bugulgad
Starting Member

21 Posts

Posted - 2010-08-23 : 19:49:43
Hi All,

I am having to figure out some table relationships manually.

Anyone know of a query in 2008 which can search tables\views for a particular column name?

Thanks

bugulgad
Starting Member

21 Posts

Posted - 2010-08-23 : 20:00:30
So far I only come up with this...which is good, but I have to know the database at least. At some point I may have to look across multiple DB's on the server

select TABLE_NAME, *
from INFORMATION_SCHEMA.COLUMNS
where COLUMN_NAME like '%date%'
Go to Top of Page

madhivanan
Premature Yak Congratulator

22864 Posts

Posted - 2010-08-24 : 03:50:23
quote:
Originally posted by bugulgad

So far I only come up with this...which is good, but I have to know the database at least. At some point I may have to look across multiple DB's on the server

select TABLE_NAME, *
from INFORMATION_SCHEMA.COLUMNS
where COLUMN_NAME like '%date%'



If you want exact column name, dont use % in the where clause

Madhivanan

Failing to plan is Planning to fail
Go to Top of Page
   

- Advertisement -