SQL Server queries table function stored procedures

Source: Internet
Author: User
Query table: select * fromsys. objectswheretypeU query Stored Procedure select * fromsys. objectswheretypeP query Stored Procedure content EXECSp_HelpText stored procedure name query User-Defined Function select * fromdbo. Explain query User-Defined Function content EXE

Query table: select * from sys. objects where type = 'U' query the Stored Procedure select * from sys. objects where type = 'P' queries the Stored Procedure content EXEC Sp_HelpText 'stored procedure name' queries the custom function select * from dbo. sysobjects WHERE xtype = 'af'


Query table:

Select * from sys. objects where type = 'U'


Query stored procedures

Select * from sys. objects where type = 'P'

Query Stored Procedure content

EXEC Sp_HelpText 'stored procedure name'


Query User-Defined Functions
Select * from dbo. sysobjects WHERE xtype = 'af'

Query the content of a custom function

EXEC Sp_HelpText 'user-Defined Function name'



You can view other types as follows:

Select xtype from dbo. sysobjects group by xtype

You can also use select * from sys. SQL _modules to view the content.

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.