Database Reference
In-Depth Information
Figure 6-2. Executing the stored procedure
How It Works
You use the CREATE PROCEDURE to create stored procedures. The AS keyword separates the signature (the
procedure's name and parameter list, but here you define no parameters) of the stored procedure from
its body (the SQL that makes up the procedure).
Create procedure sp_Select_All_PersonContact
As
select Contact.Title, Contact.FirstName, Contact.LastName
from Person.Contact
SQL Server Management Studio submitted the CREATE PROCEDURE statement, and once the stored
procedure was created, you ran it from the query pane by writing the following statement:
execute sp_Select_All_PersonContact
That's it! There's nothing complicated about creating stored procedures.
 
Search WWH ::




Custom Search