Prints the text of a rule, a default, or an unencrypted stored procedure, trigger, or view.
sp_helptext [@objname =] 'name'
0 (success) or 1 (failure)
Column name | Data type | Description |
---|---|---|
Text | nvarchar(255) | Stored procedure text |
sp_helptext prints out the text used to create an object in multiple rows, each with 255 characters of the Transact-SQL definition. The definition resides in the text in the syscomments table of the current database only.
Execute permissions default to the public role.
This example displays the text of the employee_insupd trigger, which is in the pubs database.
USE pubs
EXEC sp_helptext 'employee_insupd'
CREATE PROCEDURE | sp_help |
CREATE TRIGGER | System Stored Procedures |
CREATE VIEW |