Become Joomla Developer

How To Create Store Procedure in SQL Server 2005

Create Store Procedure

  1. Right click on Store Procedure and then click on New Stored Procedure...
    New Stored Procedure
  2. Click on Query menu and then click on Specify Values for Template Paramenter...
    Specify value
  3. Enter your name, date you created, Description, Stored Procedure Name, parameter and data type of parameter. And then click Ok button.
    Enter Parameter
  4. Alter your SQL Statement like below:
    SET ANSI_NULLS ON
    GO
    SET QUOTED_IDENTIFIER ON
    GO
    CREATE PROCEDURE spGetProductByID 
    @ProductID int
    AS
    BEGIN
    SET NOCOUNT ON;
    SELECT ProductName, Price FROM tblProduct WHERE ProductID=@ProductID
    END
    GO
    
    Or Alter it like in picture:
    Alter your SQL Statement
  5. Select your database and click Execute button
    Select Database and Click Execute button

Call Stored Procedure

  1. Click on New Query
  2. Write SQL Statement like below:
    EXEC dbo.spGetProductByID  @ProductID=2
    
  3. Select your database and click Execute button
    Select Database and Click Execute button
  4. here is your result after your execute it.
    Result

Suggestion | Contact US | About US | Term of Use | Privacy Policy | Advertiseing