Ócáid
Mar 31, 11 PM - Apr 2, 11 PM
An ócáid foghlama SQL, Fabric and Power BI is mó. Márta 31 – 2 Aibreán. Bain úsáid as cód FABINSIDER chun $ 400 a shábháil.
Cláraigh inniuNí thacaítear leis an mbrabhsálaí seo a thuilleadh.
Uasghrádú go Microsoft Edge chun leas a bhaint as na gnéithe is déanaí, nuashonruithe slándála, agus tacaíocht theicniúil.
Applies to:
SQL Server
Azure SQL Database
Azure SQL Managed Instance
Azure Synapse Analytics
Analytics Platform System (PDW)
SQL database in Microsoft Fabric
This article describes how to delete a stored procedure in SQL Server by using SQL Server Management Studio or Transact-SQL.
Deleting a procedure can cause dependent objects and scripts to fail when the objects and scripts are not updated to reflect the removal of the procedure. However, if a new procedure of the same name and the same parameters is created to replace the one that was deleted, other objects that reference it will still process successfully. For more information, see View the Dependencies of a Stored Procedure.
Requires ALTER permission on the schema to which the procedure belongs, or CONTROL permission on the procedure.
In Object Explorer, connect to an instance of Database Engine and then expand that instance.
Expand Databases, expand the database in which the procedure belongs, and then expand Programmability.
Expand Stored Procedures, right-click the procedure to remove, and then select Delete.
To view objects that depend on the procedure, select Show Dependencies.
Confirm the correct procedure is selected, and then select OK.
Remove references to the procedure from any dependent objects and scripts.
In Object Explorer, connect to an instance of Database Engine and then expand that instance.
Expand Databases, expand the database in which the procedure belongs, or, from the tool bar, select the database from the list of available databases.
On the File menu, select New Query.
Obtain the name of stored procedure to remove in the current database. From Object Explorer, expand Programmability and then expand Stored Procedures. Alternatively, in the query editor, run the following statement.
SELECT name AS procedure_name
, SCHEMA_NAME(schema_id) AS schema_name
, type_desc
, create_date
, modify_date
FROM sys.procedures;
Copy and paste the following example into the query editor and insert a stored procedure name to delete from the current database.
DROP PROCEDURE [<stored procedure name>];
GO
Remove references to the procedure from any dependent objects and scripts.
Ócáid
Mar 31, 11 PM - Apr 2, 11 PM
An ócáid foghlama SQL, Fabric and Power BI is mó. Márta 31 – 2 Aibreán. Bain úsáid as cód FABINSIDER chun $ 400 a shábháil.
Cláraigh inniuOiliúint
Modúl
Create stored procedures and user-defined functions - Training
This content is a part of Create stored procedures and user-defined functions.
Doiciméadúchán
DROP PROCEDURE (Transact-SQL) - SQL Server
Removes one or more stored procedures or procedure groups from the current database in the SQL Server Database Engine.
Modify a stored procedure - SQL Server
Learn how to modify a stored procedure in SQL Server by using SQL Server Management Studio or Transact-SQL.
Execute a stored procedure - SQL Server
Learn how to execute a stored procedure by using SQL Server Management Studio or Transact-SQL.