Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
SP Perplexities
Message
General information
Forum:
Microsoft SQL Server
Category:
Stored procedures, Triggers, UDFs
Title:
Environment versions
SQL Server:
SQL Server 2014
Application:
Desktop
Miscellaneous
Thread ID:
01624346
Message ID:
01624354
Views:
70
>
>My problem is more basic in fact. I don't understand why the first sql generates and "alter procedure" statement, where I was hoping that it would generate an executing sql.
>
>

An ALTER statement is the script that SSMS generates when you right-click on a stored procedure and choose to modify it.

When you execute that script (after making any changes), SSMS executes the ALTER script, which (essentially) pushes the script back to the database.

Generally, here are the things you can do with a proc...

CREATE PROCEDURE dbo.Whatever
as
-- code for procedure

When you "execute" this script, it will save the proc back to the database (if it doesn't already exist)


ALTER PROCEDURE dbo.Whatever
as
-- change existing code

When you "execute" this script, it will push the changes back to the database and overwrite the existing proc. Executing this script (that begins with an ALTER PROCEDURE statement) doesn't run the code on the inside...it basically pushes the changes back to the database.


Now...you can also do these 2...

EXEC dbo.MyProc

This will actually run the code inside the procedure

And finally, you can do this.;..

DROP PROCEDURE

That will delete the procedure from the database
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform