SQL Server allows us to view the definition, information, and dependencies of a stored procedure.
sp_helptext spNewAvgGrade;
CREATE PROCEDURE spGetAvgGrade (@Course INTEGER)
AS
SELECT AVG(Std_Grade) as AverageGrade FROM Students
WHERE Std_Course = @Course
In the above example, the sp_helptext displays the text of the spNewAvgGrade stored procedure.
sp_help spNewAvgGrade;
Name Owner Type Created_datetime
spNewAvgGrade
dbo
stored procedure
2003-09-14 23:53:13.810
Parameter_name
Type
Length
Prec
Scale
Param_order
@Course int 4 10 0 1
This example displays information about the stored procedure.
sp_depends spNewAvgGrade;
In the current database, the specified object references the following:
Name
Type Updated Selected Column
dbo.Students user table no no Std_Course
dbo.Students user table no no Std_Grade
This example shows the dependencies of the stored procedure.