How to modify/alter and delete/drop a stored procedure?

851    Asked by akashMishra in SQL Server , Asked on Jan 26, 2020
Answered by Rachit Gupta

Via GUI

1. Connect to server

2. Connect to the database

For Alter/ Modify

Click on the database and expand--> Click on Programmability --> Click on stored Procedure --> Right click on Procedure Nameà Script store procedureà Alter Toà New Query Editor Window

For Delete/ drop

Click on the database and expand--> Click on Programmability --> Click on stored Procedure --> Right click on Procedure Nameà Script store procedureà Drop Toà New Query Editor Window

4. then alter the procedure contents which you want to change and execute the statement ( only execute in case of dropping the procedure)


Via SQL statements :

1. Connect to server

2. Connect to the database

For Alter/ Modify

Get the old procedure via executing below statement :

Sp_helptext ‘Schema_Name.Procedurename’

Copy past the result in the editor and make changes in the procedure: make change from create procedure to alter procedure and execute

For Delete/ drop

Write the below statement:

             Drop Procedure ‘Schema_Name.Procedurename’


Your Answer

Interviews

Parent Categories