Viewing Stored Procedures

You can view the source code for stored procedures in SQL Server 2008 by querying the definition column of the object catalog view sys.sql_modules or by using the system procedure sp_helptext (see Listing 28.9).

Listing 28.9 Viewing Code for a Stored Procedure by Using sp_helptext

image

By default, all users have permission to execute sp_helptext to view the SQL code for the stored procedures in a database. If you want to protect the source code of stored procedures and keep its contents from prying eyes, you can create a procedure by using the WITH ENCRYPTION option. When this option is specified, the source code stored ...

Get Microsoft® SQL Server 2008 R2 Unleashed now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.