Generally, once a stored procedure is created, the details of how it works can be forgotten. Sometimes however, what a procedure does may need to be researched. The following query makes an attempt to look-up the definition for a stored procedure in SQL Server.
NOTE: Set the value in the DECLARE line at the top to the procedure name to look for (partial strings are fine).
NOTE: SQL Server has the ability to encrypt the definition for a procedure. A definition value of NULL likely means such is the case for this procedure.
NOTE: Set the value in the DECLARE line at the top to the procedure name to look for (partial strings are fine).
NOTE: SQL Server has the ability to encrypt the definition for a procedure. A definition value of NULL likely means such is the case for this procedure.
DECLARE @procedureName VARCHAR(MAX) = 'PROCEDURENAME'
SELECT
sys.all_objects.name AS storedProcedureName
,sys.all_sql_modules.definition AS storedProcedureDefinition
FROM
sys.all_sql_modules
INNER JOIN sys.all_objects
ON sys.all_sql_modules.object_id = sys.all_objects.object_id
WHERE sys.all_objects.name LIKE '%' + @procedureName + '%'
Comments
Post a Comment