Hides the source text for the specified compiled object, as well as the text of computed columns, predicates, and function-based index keys. sp_hidetext also encrypts the text for user-defined functions.
sp_hidetext [objname[, tabname[, username]]]
specifies the compiled object for which to hide the source text.
specifies the name of the table or view for which to hide the source text.
specifies the name of the user who owns the compiled object for which to hide the source text.
Hides the source text of all compiled objects in the current database:
sp_hidetext
Hides the source text of the user-defined stored procedure, sp_sort_table, that is owned by Mary:
sp_hidetext @objname = "sp_sort_table", @username = "Mary"
Hides the source text of the stored procedure pr_phone_list:
sp_hidetext "pr_phone_list"
Hides the source text of all check constraints, defaults, and triggers defined on the table my_tab:
sp_hidetext @tabname = "my_tab"
Hides the source text of the view my_vu and all check constraints, defaults, and triggers defined on the table my_tab:
sp_hidetext "my_vu", "my_tab"
Hides the source text of all compiled objects that are owned by Tom:
sp_hidetext @username = "Tom"
sp_hidetext hides the source text for the specified compiled object.
WARNING! Before executing sp_hidetext, make sure you have a backup of the source text. The results of executing sp_hidetext are not reversible.
If you do not provide any parameters, sp_hidetext hides the source text for all compiled objects in the current database.
If you use sp_hidetext followed by a cross-platform dump and load, you must manually drop and re-create all hidden objects.
The permission checks for sp_hidetext differ based on your granular permissions settings.
Granular permissions enabled |
With granular permissions enabled, you must be a user with manage database privilege. Any user can execute sp_hidetext to hide the source text of their own compiled objects. |
Granular permissions disabled |
With granular permissions disabled, you must be the datatype owner or a user with sa_role. Any user can execute sp_hidetext to hide the source text of their own compiled objects. |
Values in event and extrainfo columns from the sysaudits table are:
Event |
Audit option |
Command or access audited |
Information in extrainfo |
---|---|---|---|
38 |
exec_procedure |
Execution of a procedure |
|
Commands dump database, dump transaction, load database, load transaction
Documents See the Transact-SQL User’s Guide for more information about hiding source text.
System procedures sp_checksource