Saturday, April 8, 2017

sp_helptext in SQL server

sp_helptext is used to view the code/text or content of the unencrypted stored procedures, user defined functions, triggers and view.


            sp_helptext @objname = 'name'
            sp_helptext [@objname=] 'name' [,[@columnname=] computed_column_name

[ @objname = ] 'name'

Is the name of a object. Quotation marks are required only if a qualified object is specified. If a fully qualified name, including a database name, is provided, the database name must be the name of the current database. The object must be in the current database. name is nvarchar(776), with no default.

[ @columnname = ] 'computed_column_name'

Is the name of the computed column for which to display definition information. The table that contains the column must be specified as name. column_name is sysname, with no default.


In the query window, enter the following statement that uses the sp_helptext system stored procedure. Change the database name and stored procedure name to reference the database and stored procedure that you want.

USE AdventureWorks2008; 
EXEC sp_helptext N'AdventureWorks2008.dbo.uspLogError';

Share This
Previous Post
Next Post

TekGrabs, established in 2017, is in the business of sharing Information. It provides news, articles and photos about the different technologies, inventions in different domains. Provides information on programming and databases.