sql - How to find stored procedure which contains given string -


Many store processes have been made in my database. But I need to search for the stored procedure in its definition, Welcome 'included. I can check each stored function by sp_helptext. I have many stored procedures so I can check sparse processing using sp_help because its time consuming

please If you can

You can see the system view SYS.SQL_MODULES and SYS.OBJECTS I have created a stored procedure to find any of the text within any type of object

below

check it
  Create process [SearchFromObjects] (select @SearchString NVARCHAR (500) = zero, @SearchObjectList VARCHAR (50) = null) set set ANSI_NULLS set QUOTED_IDENTIFIER as NOCOUNT initially announced @sqlQuery NVARCHAR (1000) @SearchObjectList = '' '+ + REPLACE (@SearchObjectList,' ',' ',' '') + '' '' If ISNULL (@SearchString, '') & lt; & Gt; Select 'start' selection @sqlQuery = 'As SYS_OBJ.NAME [OBJECT_NAME], the case when SYS_OBJ.TYPE =' 'p' 'then' 'process'' when SYS_OBJ.TYPE = '' t. R. ' 'Then' 'TRIGGER' when SYS_OBJ.TYPE = '' FN '' then '' SCALAR function 'when SYS_OBJ.TYPE =' 'TF' 'then' 'table-valued function' when SYS_OBJ.TYPE = ' '' If 'and' inline table-valued function '' wHEN SYS_OBJ.TYPE = '' V '' then '' scene '' end [Obijeiititiii] F ROM SYS.SQL_MODULES SYS_MOD INNER JOIN SYS.OBJECTS SYS_OBJ.OBJECT_ID on SYS_OBJ = SYS_MOD.OBJECT_ID where '@SearchString +'% '' like SYS_MOD.DEFINITION + case when ISNULL (@SearchObjectList, '') & lt; & Gt; '' Then 'and print SYS_OBJ.TYPE (' + @ SearchObjectList + ')' left 'end' end + SYS_OBJ.TYPE order '' If (IsNull (@SearchString, '') = '') 'error: Wrong sentence - configuration ... !!! 'Print' print '-----------------------------------' print 'process can take two arguments 'Print' ----------------------------------- 'Print' [1] Search String: To Search String object defination (required) for 'print' syntax: EXEC [SearchFromObjects] '' & lt; & Lt; To search the string & gt; & Gt; For example: 'print' for example: EXEC [SearchFromObjects] '' '' Welcome to 'print' [2] Search the type of object: List of object types in which users want to search (optional) Print 'syntax: Exec [Search object] '' & lt; & Lt; String to search & gt; & Gt; "," & Lt; & Lt; For example a list of objects, for example EXEC [SearchFromObjects] "Welcome", P, TR, FN, TF, IF, V '' print '' print '' list type 'print' - ------------------------------------- 'Print' type description 'print' ---- ----------------------------------- 'print' p process' print tr trigger 'print' FN scalal Function 'Print' TF Table-Valued Function 'Print if Inline Table-Valued Function' Print 'V' Print '----------- --------- ------------------- 'and Iand EX Akschuatt (@ Skyuelakwayri) and ST set of offset set Aansai_anelels SET on Kwatdiidentifayr and live  
< P> Pass just two parameters 1) String ('Welcome') and 2) Object type ('P' for process) You will get stored procedure name which includes your search string

  EXEC [Welcome to SearchFromObjects] 'Welcome', 'P'  

Without Finder [SearchFromObjects] can get more help


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -