Prints the text of a rule, a default, or an unencrypted stored procedure, trigger, or view.
sp_helptext objname
where
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.
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.
Execute permission defaults to the public group.
syscomments
CREATE DEFAULT statement | CREATE TRIGGER statement |
CREATE PROCEDURE statement | CREATE VIEW statement |
CREATE RULE statement | sp_help |