Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p><strong>QUERY sys.sql_modules</strong><br> use this procedure, where you pass in the function name:</p> <pre><code>CREATE PROCEDURE dbo.Find_Text @SearchValue nvarchar(500) AS SELECT DISTINCT s.name+'.'+o.name AS Object_Name,o.type_desc FROM sys.sql_modules m INNER JOIN sys.objects o ON m.object_id=o.object_id INNER JOIN sys.schemas s ON o.schema_id=s.schema_id WHERE m.definition Like '%'+@SearchValue+'%' --AND o.Type='P' --&lt;uncomment if you only want to search procedures ORDER BY 1 GO </code></pre> <p>This procedure searches within procedures, views, and functions for the given string. You can search for any string, not just function names. You can also include wild cards in the middle of the given search term.</p> <p><strong>FUNCTION DEFAULTS</strong><br> you can specify default values for function parameters. However, When a parameter of the function has a default value, the keyword DEFAULT must be specified when the function to retrieve the default value. This behavior is different from using parameters with default values in stored procedures in which omitting the parameter also implies the default value.</p> <p>try it out:</p> <pre><code>CREATE FUNCTION dbo.Just_Testing ( @Param1 int ,@Param2 int=0 ) RETURNS varchar(100) BEGIN RETURN CONVERT(varchar(10),@Param1)+'-'+CONVERT(varchar(10),@Param2) END GO PRINT 'hello world '+dbo.Just_Testing(2,default)+', '+dbo.Just_Testing(5,2) GO PRINT 'hello world '+dbo.Just_Testing(2 )+', '+dbo.Just_Testing(5,2) </code></pre> <p>OUTPUT:</p> <pre><code>hello world 2-0, 5-2 Msg 313, Level 16, State 2, Line 1 An insufficient number of arguments were supplied for the procedure or function dbo.Just_Testing. </code></pre> <p>But I'm guessing that you need to change a function, adding as parameter, and now need to fix it everywhere. This <code>DEFAULT</code> would still be as much work, since you need to touch every call made to it.</p> <p><strong>SP_DEPENDS</strong><br> you can also use <a href="http://msdn.microsoft.com/en-us/library/ms189487.aspx" rel="noreferrer">sp_depends (Transact-SQL)</a> to find every usage of the function.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload