Udostępnij za pośrednictwem


DROP PROCEDURE (Transact-SQL)

Removes one or more stored procedures or procedure groups from the current database.

Topic link iconTransact-SQL Syntax Conventions

Syntax

DROP { PROC | PROCEDURE } { [ schema_name. ] procedure } [ ,...n ]

Arguments

  • schema_name
    Is the name of the schema to which the procedure belongs. A server name or database name cannot be specified.
  • procedure
    Is name of the stored procedure or stored procedure group to be removed. Procedure names must follow the rules for identifiers.

Remarks

To see a list of procedure names, use the sys.objects catalog view. To display the procedure definition, use the sys.sql_modules catalog view. When a stored procedure is dropped, information about the procedure is removed from the sys.objects and sys.sql_modules catalog views.

Individual procedures within a group of numbered procedures cannot be dropped; the whole procedure group is dropped. For more information about grouped procedures, see CREATE PROCEDURE (Transact-SQL).

Permissions

Requires ALTER permission on the schema to which the procedure belongs, or CONTROL permission on the procedure.

Examples

The following example removes the dbo.uspMyProc stored procedure in the current database.

DROP PROCEDURE dbo.uspMyProc;
GO

See Also

Reference

ALTER PROCEDURE (Transact-SQL)
CREATE PROCEDURE (Transact-SQL)
EVENTDATA (Transact-SQL)
sp_depends (Transact-SQL)
sp_rename (Transact-SQL)
sys.objects (Transact-SQL)
sys.sql_modules (Transact-SQL)
sys.parameters (Transact-SQL)

Other Resources

Deleting Stored Procedures
How to: Delete a Stored Procedure (SQL Server Management Studio)

Help and Information

Getting SQL Server 2005 Assistance