How to find stored procedure calls?

Is there a way to find where stored procedures are stored in a SQL Server 2005 database?

I tried using Find, but this does not work, as in Visual Studios.

Thanks in advance.

+6
source share
4 answers

If you need to find database objects (for example, tables, columns, triggers) by name - look at the FREE Red-Gate tool called SQL Search , which does this - it searches your entire database for any rows (rows).

So, in your case, if you know what is caused by the stored procedure that you are interested in, just enter the key in the search field and SQL Search will quickly show you all the places where this stored procedure is called.

enter image description here

enter image description here

This is a great tool for any database or database developer - I already mentioned this for FREE for any kind of use

+11
source

You can try using View Dependencies in SQL Server Management Studio.

Right-click the saved procedure and select View Dependencies . However, I found that it is not always 100% accurate.

+6
source

You can create a "find" SP

I use this method to search for text in database objects:

 CREATE sp_grep (@object varchar(255)) as SELECT distinct 'type' = case type when 'FN' then 'Scalar function' when 'IF' then 'Inlined table-function' when 'P' then 'Stored procedure' when 'TF' then 'Table function' when 'TR' then 'Trigger' when 'V' then 'View' end, o.[name], watchword = @object FROM dbo.sysobjects o (NOLOCK) JOIN dbo.syscomments c (NOLOCK) ON o.id = c.id where c.text like '%' +@object +'%' 
+6
source

View stored procedure dependencies :

 select * from sys.dm_sql_referencing_entities('[SchemaName].[SPName]', 'OBJECT'); 
+1
source

Source: https://habr.com/ru/post/913335/


All Articles