Resource for SQL Server Stored Procedure - SQL Stored Procedure Help

Send a Message


 

 

 


 
  

Need help with Microsoft SQL Server? Ask our Experts, or simply Email your query.

About Sql Server Programmers

Our clients can be found both locally in the Chicagoland area and throughout the country. We have over 16 years of experience and are extremely proud of our track record of successfully assisting hundreds of our clients to improve their productivity while focusing on cost.

Microsoft Certified Partner

  

SQL Server Stored Procedures

If you have a query that you want to execute often, you might want to make a stored procedure out of it.  Stored procedures help to avoid SQL injection.  (SQL injection is a code injection technique that exploits a security vulnerability occurring in the database layer of an application.)   Creating a procedure also means that the SQL script is logically separated from other parts of the application.  This often helps in the maintenance of a project.  To create a stored procedure, please do the following.

Select Procedure

  1. Type “Create procedure” then provide the name of the procedure.  (Note: if you are altering an existing table, please use the Alter keyword instead of create)
  2. Add the parameters that you are going to use (Note: in parenthesis)
    • These are the variables that are to be used within the query.
    • When you call the query, you must supply these variables.
  3. Add the keyword “as” after you close the parenthesis for the parameters
  4. Insert the SQL query. 
  5. Run this query using F5 or the Execute Button.