drop procedure

Description

Removes a procedure.

Syntax

drop proc[edure] [owner.]procedure_name 
	[, [owner.]procedure_name] ... 

Parameters

procedure_name

is the name of the Transact-SQL or SQLJ procedure to drop. Specify the owner’s name to drop a procedure of the same name owned by a different user in the current database. The default value for owner is the current user.

Examples

Example 1

Deletes the stored procedure showind:

drop procedure showind

Example 2

Unregisters the extended stored procedure xp_echo:

drop procedure xp_echo

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

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

Granular permissions enabled

With granular permissions enabled, you must be the procedure owner or a user with drop any procedure privilege.

Granular permissions disabled

With granular permissions disabled, you must be the procedure owner or a user with sa_role.

Auditing

Values in event and extrainfo columns of sysaudits are:

Event

Audit option

Command or access audited

Information in extrainfo

28

drop

drop procedure

  • Roles – current active roles

  • Keywords or options – NULL

  • Previous value – NULL

  • Current value – NULL

  • Other information – NULL

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

See also

Commands create procedure, create procedure (SQLJ)

System procedures sp_depends, sp_dropextendedproc, sp_helpextendedproc, sp_helptext, sp_rename