How to find column usage in stored procedure?

Sometimes you want to rename or delete column from a table in MS SQL Server. How to find column name dependency usage in MS SQL Server? There is no clean way of doing this. In management studio you can right click on object and select "View Dependency", but this would show only object dependency. So you need to write some T-SQL code in order to find dependency. Lets say we need to find dependecy of Title column from the Article table.

SELECT DISTINCT so.name

FROM sys.syscomments sc

INNER JOIN sys.objects so on sc.id=so.object_id

WHERE sc.text LIKE '%Title%'


Posted on Sunday, May 8, 2011 by | Comments (3) | Add Comment

Comments

Gravatar

Re:How to find column usage in stored procedure?

Thank you!..i was hunting around for this forever.

Posted on 5/9/2011 11:38:33 AM by ASP.Net Halifax #
Gravatar

Re:How to find column usage in stored procedure?

this is very useful. as i was struggling to find a solution which can return me the stored procedure related details.

Posted on 5/16/2011 5:56:02 AM by deepa #
Gravatar

Re: How to find column usage in stored procedure?

Thankyou very much......
It was helpful

Posted on 1/11/2012 10:21:49 PM by Arif #

New Comment

Your Name:
Email (for internal use only):
Comment:
 
Code above:

Categories

Recent Tweets

  • Simon Ince's Blog: Hierarchies with HierarchyID in SQL 2008 http://t.co/xSDwiF6rRS.
  • Visual Studio 2010 WAS painfully slow - CodeProject http://t.co/Usba1x6CZy

Valid HTML5