Prints the text of a rule, a default, or an unencrypted stored procedure, user-defined function, trigger, or view.
sp_helptext [ @objname = ] 'name'
[@objname =] 'name'
Is the name of the object for which to display definition information. The object must be in the current database. name is nvarchar(776), with no default.
0 (success) or 1 (failure)
Column name | Data type | Description |
---|---|---|
Text | nvarchar(255) | Object definition 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'