Reputation: 1233
I need to modify a stored procedure, and I wanted to get some insight on what "modifying" a stored procedure actually does. I have a stored procedure, and in it is a statement like:
ALTER PROCEDURE [dbo].[get_orders]
INSERT INTO customer (id, date, name)
VALUES(@id, getdate(), @name)
SELECT
full_id,
fname,
lname,
...
FROM orders
If I modify this stored procedure (right click the sp in SSMS, and select "Modify") by adding a column to the Select statement for example, and then click "Execute" (or press F5), will this just update the stored procedure definition, or will it also "run" the code in it, for example, run the "INSERT" statement (or if there was a "DELETE") and actually do some inserting (or deleting)?
I'm assuming that it will just update the stored procedure, and not actually run the queries in it, but I just want to be sure. Sorry if this question seems basic, but I couldn't easily find an answer.
Thanks in advance!
Upvotes: 0
Views: 960
Reputation: 2636
if you execute on that statement it should only store the procedure changes.
When you find your procedure in the explorer then hit execute it will then run the procedure.
Upvotes: 1
Reputation: 35407
When you alter
the definition of the stored procedure that is all that you're doing — altering the definition/code inside said procedure. It is not going to execute
the procedure, to do so you'll need to exec
your procedure after it has been alter
ed.
Upvotes: 2