devxlogo

View SQL Behind System Stored Procedures

View SQL Behind System Stored Procedures

If you are ever trying to write SQL to access SQL server’s system tables, it is often useful to look at SQL Server’s own system stored procedures. You can do this by simply running EXEC sp_helptext system_proc_name (where system_proc_name is the name of the stored procedure you want see the SQL for) from the master database.

For example, EXEC sp_helptext sp_help will show the SQL executed by the system stored procedure sp_help, which returns information about an object, such as a table, view, or stored procedure.

devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist