SQL Server books online: delete stored procedures

Source: Internet
Author: User
Tags sql server books
Delete stored procedure

You can delete stored procedures when they are no longer needed. If another stored procedure calls a deleted stored procedure, Microsoft SQL Server 2000 displays an error message when executing the call procedure. However, if a new stored procedure with the same name and parameters is defined to replace the deleted stored procedure, other processes that reference the procedure can still be executed smoothly. For example, if the Stored Procedure proc1 references the Stored Procedure proc2 and proc2 is deleted but another Stored Procedure named proc2 is created, proc1 will reference this new stored procedure now, you do not have to recompile proc1.

After a stored procedure group, a single stored procedure in the group cannot be deleted. Deleting a stored procedure deletes all stored procedures in the same group.

Drop procedure

Deletes one or more stored procedures or process groups from the current database.

Syntax

Drop procedure {Procedure}[,...N]

Parameters

Procedure

Is the name of the stored procedure or stored procedure group to be deleted. The process name must comply with the identifier rules. For more information, see use identifiers. You can choose whether to specify the process owner name, but not the server name and database name.

N

Yes indicates that multiple process placeholders can be specified.

Note

To view the process name list, useSp_help.To display the process definition (stored inSyscommentsIn the system table), useSp_helptext.When a stored procedure is removedSysobjectsAndSyscommentsThis process is deleted from the system table.

Individual processes in the group cannot be removed. The entire process group must be removed.

Regardless of the user-defined system process (SP _Is the prefix.MasterRemove from the database. If the system process is not found in the current database, Microsoft SQL Server triesMasterRemove the database.

Permission

By default, the drop procedure permission is granted to the process owner, which cannot be transferred. However,Db_ownerAndDb_ddladminFixed database role members andSysAdminA fixed server role member can remove any object by specifying the owner in drop procedure.

Example

Delete the following exampleByroyaltyStored Procedure (in the current database ).

Drop procedure byroyalty

Go

From: http://goaler.xicp.net/ShowLog.asp? Id = 518

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.