T-SQL Tutorial

T-SQL Alter Procedure


This article describes how to alter procedure in SQL Server database.
The T-SQL statement ALTER PROCEDURE modifies a stored procedure in current the database.



Alter Procedure syntax

ALTER PROCEDURE procedure_name AS SQL statement GO;

Create Procedure example

use model;
GO
CREATE PROCEDURE CourseSales
@Name nvarchar(50)
AS
select c.name, sum(c.price) total
from courses c, register_course r
where c.id=r.course_id
and c.name=@Name
group by c.name;
GO


Alter Procedure example

use model;
GO
ALTER PROCEDURE CourseSales
@Name nvarchar(50)
AS
select c.name, sum(c.price) total
from courses c, register_course r
where c.id=r.course_id
and c.price > 50
and c.name=@Name
group by c.name;
GO