Situatie
Mai jos este o procedura ce primeste un parametru de tip string si cauta acest string in codul tuturor procedurilor stocate de pe o baza de date Microsoft SQL Server si returneaza toate procedurile in care se gaseste acel string.
Solutie
ALTER PROCEDURE SearchInProcedureCode
@StringToBeSearched varchar(max)
as
SELECT
DISTINCT
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
WHERE
m.definition Like @StringToBeSearched
ORDER BY 1
Leave A Comment?