Please review the site disclaimer before downloading or using content found on this site
Written by: Steve Gray 8/10/2010 4:51 PM
It is occasionally necessary to find all the occurrences of a field name in a SQL Server database. This script will seacrh the database and return all the tables that contain a certain field name.
select sysobjects.name from syscolumns left join sysobjects on sysobjects.id = syscolumns.id where syscolumns.name like 'myFieldName' order by 1
select sysobjects.name
from syscolumns
left join sysobjects on sysobjects.id = syscolumns.id
where syscolumns.name like 'myFieldName'
order by 1
0 comment(s) so far...