KARPACH

WEB DEVELOPER BLOG

How to find column usage in stored procedure?

Sometimes you want to rename or delete a 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 the 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 a dependency. Let’s say we need to find the dependency of a 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 May 8, 2011 by

Comments

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

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

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

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

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

Thankyou very much……

It was helpful