.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Top 5 Contributors of the Month
david stephan
Gaurav Pal

Home >> Code Snippets >> SQL Query >> Post New Resource Bookmark and Share   

 Subscribe to Code Snippets

Find Stored Procedure, Views, Funtions and Triggers Related to Table in Database

Posted By:Sasi Prabhu       Posted Date: January 04, 2013    Points: 40    Category: SQL Query    URL: http://www.dotnetspark.com  

To find the Table which are used in the SP in Database.

SELECT DISTINCT o.name, o.xtype
FROM syscomments c
INNER JOIN sysobjects o ON c.id=o.id
WHERE c.TEXT LIKE '%tablename%'

Use exec sp_depends table_name which will show active object information.

This query will list the Stored Procedure, Views, Functions and Tiggers list which contains the mentioned table name.


Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply
Find More code samples in C#, ASP.Net, Vb.Net and more Here

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend