Home >> FAQs/Tutorials >> SQL Server FAQ

SQL Server FAQ - "CREATE PROCEDURE" - Creating Simple Stored Procedures

By: FYIcenter.com

(Continued from previous topic...)

How To Create a Simple Stored Procedure?

If you want to create a simple stored procedure with no input and output parameters, you can use the "CREATE PROCEDURE" command with a statement batch in a simple format as shown in below:

         
CREATE PROCEDURE procedure_name AS
   statement_1;
   statement_2;
   ...        
   statement_n;
GO            

The following tutorial exercise shows you how to create a simple stored procedure:

         
USE FyiCenterData;
GO            

CREATE PROCEDURE Hello AS
   SELECT 'Welcome to:';
   SELECT '   FYIcenter.com';
GO
Command(s) completed successfully.

EXEC Hello;
GO

-----------
Welcome to;
(1 row(s) affected)

----------------
   FYIcenter.com
(1 row(s) affected)

(Continued on next topic...)

  1. What Are Stored Procedures?
  2. How To Create a Simple Stored Procedure?
  3. How To Execute a Stored Procedure?
  4. How To List All Stored Procedures in the Current Database?
  5. How To Drop an Existing Stored Procedure?
  6. How To Create a Stored Procedure with a Statement Block?
  7. How To End a Stored Procedure Properly?
  8. How To Generate CREATE PROCEDURE Script on an Existing Stored Procedure?
  9. How To Get the Definition of a Stored Procedure Back?
  10. How To Modify an Existing Stored Procedure?
  11. How To Create Stored Procedures with Parameters?
  12. How To Provide Values to Stored Procedure Parameters?
  13. What Are the Advantages of Passing Name-Value Pairs as Parameters?
  14. Can You Pass Expressions to Stored Procedure Parameters?
  15. How To Provide Default Values to Stored Procedure Parameters?
  16. How To Define Output Parameters in Stored Procedures?
  17. How To Receive Output Values from Stored Procedures?
  18. How To Create a Local Temporary Stored Procedure?
  19. Can Another User Execute Your Local Temporary Stored Procedures?

Related Articles:

More...


Other Tutorials/FAQs:

More...


Related Resources:

More...


Selected Jobs:

More...