SQL Server books online: View stored procedures

Source: Internet
Author: User
Tags sql server books

Several system stored procedures use system tables to provide information about stored procedures. You can use these stored procedures:

    • View the statements used to create a stored procedure. This is useful for users who do not have a Transact-SQL script file used to create a stored procedure.
    • Obtain information about a stored procedure, such as the owner, Creation Time, and parameters of the stored procedure ).
    • Lists the objects used by the specified stored procedure and the procedure for using the specified stored procedure. This information can be used to identify the processes affected by changes or deletions to an object in the database.
View the definition of the stored procedure sp_helptext

Displays the text of rules, default values, unencrypted stored procedures, user-defined functions, triggers, or views.

Syntax

Sp_helptext[@ Objname =]'Name'

Parameters

[@ Objname =]'Name'

Object Name. The definition information of the object is displayed. The object must be in the current database.NameThe data type of isNvarchar (776), No default value.

Return Code Value

0 (successful) or 1 (failed)

Result set

Column name Data Type Description
Text Nvarchar (255) Object definition text

Note

Sp_helptextThe text used to create an object is displayed in multiple rows. Each row contains 255 characters defined by Transact-SQL. These definitions only reside in the current databaseSyscommentsTable text.

Permission

Execution permission is granted by defaultPublicRole.

Example

The following example showsEmployee_insupdTrigger text, which is stored in the databasePubs.

 
Use pubs
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.