sp_hidetext

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.

Syntax

sp_hidetext [objname[, tabname[, username]]]

Parameters

Examples

Usage

There are additional considerations when using sp_hidetext:
  • 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.

  • sp_helprotect ... expand_predicate prints a null predicate if text has been hidden.

  • Hidden syscomments.text is not available for use by sp_helprotect.

  • The SAP ASE server allows the predicate owner or the SSO to hide the text of a predicate. Hidden syscomments.text is not available for use by sp_helprotect. Users must be warned that the expand_predicate option of sp_helprotect prints a null predicate if text has been hidden.

  • If you use sp_hidetext followed by a cross-platform dump and load, you must manually drop and re-create all hidden objects.

See also:
  • dump database, dump transaction, load database, load transaction in Reference Manual: Commands

  • Transact-SQL User’s Guide for more information about hiding source text.

Permissions

The permission checks for sp_hidetext differ based on your granular permissions settings.

SettingDescription
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.

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.

Auditing

Values in event and extrainfo columns from the sysaudits table are:

InformationValues
Event

38

Audit option

exec_procedure

Command or access audited

Execution of a procedure

Information in extrainfo
  • Roles – Current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – All input parameters

  • Proxy information – Original login name, if set proxy in effect

Related reference
sp_checksource