Find a Table/Table Column usage across DB – SQL Server

Posted: May 23, 2013 in SQLServer
Tags: , , ,

— Following query is helpful to find all db objects that used to set value for the given columnname of a table …

select distinct name,o.type
from syscomments c
join sysobjects o on c.id = o.id
where TEXT like ‘%TableName%’ and TEXT like ‘%Set%ColumnName%’
order by name

— Finding table dependencies using SP

sp_depends ‘<Table Name>’

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s