sp_helptext (Transact-SQL)
SQL Server 2008
Displays the definition of a user-defined rule, default, unencrypted Transact-SQL stored procedure, user-defined Transact-SQL function, trigger, computed column, CHECK constraint, view, or system object such as a system stored procedure.
sp_helptext displays the definition that is used to create an object in multiple rows. Each row contains 255 characters of the Transact-SQL definition. The definition resides in the definition column in the sys.sql_modules catalog view.
A. Displaying the definition of a trigger
The following example displays the definition of the uBillOfMaterials trigger in the AdventureWorks database.
USE AdventureWorks; GO EXEC sp_helptext 'Production.uBillOfMaterials'; GO
B. Displaying the definition of a computed column
The following example displays the definition of the computed column TotalDue on the SalesOrderHeader table in the AdventureWorks database.
USE AdventureWorks; GO sp_helptext @objname = N'AdventureWorks.Sales.SalesOrderHeader', @columnname = TotalDue ; GO
Here is the result set.
Text -------------------------------------------- (isnull(([SubTotal]+[TaxAmt])+[Freight],(0)))

