sp_helptext System Stored Procedure

Prints the text of a rule, a default, or an unencrypted stored procedure, trigger, or view.

Syntax

sp_helptext objname

where

objname
Specifies the object about which the definition is to be displayed. The object must be in the current database.

Remarks

Executing sp_helptext prints out the text that was used to create the object. It looks for the text in the syscomments table of the current database only.

If an object (stored procedure, trigger or view) was created with the ENCRYPTION option, then sp_helptext will display garbled text.

With SQL Server 6.0, sp_helptext no longer displays the count of rows to be returned before it returns those rows.

Example

This example displays the text of the employee_insupd trigger. Since this trigger is in the pubs database, this example must be executed from pubs.

Permission

Execute permission defaults to the public group.

Table Used

syscomments

See Also

CREATE DEFAULT statement CREATE TRIGGER statement
CREATE PROCEDURE statement CREATE VIEW statement
CREATE RULE statement sp_help