Home All Groups Group Topic Archive Search About

find out which tables used a specific field

Author
17 Feb 2006 7:36 PM
js
hi, how to find out which tables used a specific field in one database?
Thanks.

Author
17 Feb 2006 7:43 PM
SQL
just replace 'YourColumn' with the field you are looking for

SELECT c.TABLE_NAME,* FROM INFORMATION_SCHEMA.COLUMNS c join
INFORMATION_SCHEMA.TABLES t on c.TABLE_NAME =t.TABLE_NAME
WHERE TABLE_TYPE ='BASE TABLE'  -- leave this out if you need views
also
AND COLUMN_NAME ='YourColumn'

http://sqlservercode.blogspot.com/
Author
17 Feb 2006 7:43 PM
Dean
will this do?

SELECT TABLE_NAME
FROM INFORMATION_SCHEMA.COLUMNS
WHERE COLUMN_NAME='your_column_name'

hth,

dean

Show quote
"js" <j*@someone.com> wrote in message
news:e0Zeml$MGHA.1312@TK2MSFTNGP09.phx.gbl...
> hi, how to find out which tables used a specific field in one database?
> Thanks.
>
>
>
>

AddThis Social Bookmark Button