Modifying Stored Procedures
You can modify the text of a stored procedure by using the ALTER PROCEDURE
statement. The syntax for ALTER PROCEDURE
is similar to the syntax for CREATE PROCEDURE
(see Listing 28.10). Using ALTER PROCEDURE
has a couple advantages over dropping and re-creating a procedure to modify it. The main advantage is that you don’t have to drop the procedure first to make the change, so it remains available, even if the ALTER PROCEDURE
command fails due to a syntax or object reference error. The second advantage is that because you don’t have to drop the procedure, you don’t have to worry about reassigning permissions to it after modifying it.
Get Microsoft® SQL Server 2008 R2 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.