Database Reference
In-Depth Information
Deleting Stored Procedures
Once a stored procedure is created, you can delete it if you don't need its functionality.
Drop Procedure
procedure_name
is the basic syntax for this.
Note
Because we will require these created stored procedures, if you choose to delete one in the following
exercise, please then re-create it so any dependencies will not be lost.
Try It: Deleting a Stored Procedure
Let's delete our first store procedure (
sp_Select_All_PersonContact
), which we have just renamed to
sp_Select_All_ContactDetails
.
1.
Enter the following statement (replace the query with this statement) in the
query pane, and click Execute:
Drop
procedure sp_Select_All_ContactDetails
2.
You will see the following message:
Command(s)
completed successfully.
3.
After deleting the stored procedure, navigate to the Object Explorer, and
expand the AdventureWorks database node; then expand Programmability,
right-click the Stored Procedures node, and select Refresh. Notice that the
procedure
sp_Select_All_ContactDetails
has been deleted (see Figure 6-9),
and it is not listed in the Object Explorer anymore, as you can see in Figure 6-8.