Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
SP Perplexities
Message
Information générale
Forum:
Microsoft SQL Server
Catégorie:
Stored procedures, Triggers, UDFs
Titre:
Versions des environnements
SQL Server:
SQL Server 2014
Application:
Desktop
Divers
Thread ID:
01624346
Message ID:
01624354
Vues:
69
>
>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
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform