"how to search a string in databases of sql server" Code Answer

2

search given string in the procedures/functions/triggers

this is actually far easier.

select object_name(object_id), definition
  from sys.sql_modules
 where definition like '%'+@searchstr+'%'

one way to use it is to add it to the end of your tsql code, i.e modify the last select:

select columnname, columnvalue
  from @results
 union all
select object_name(object_id), definition
  from sys.sql_modules
 where definition like '%'+@searchstr+'%'

personally, i'd just run them separately one after the other as separate statements.

By Conor Taylor on January 29 2022

Answers related to “how to search a string in databases of sql server”

Only authorized users can answer the Search term. Please sign in first, or register a free account.