-- =============================================

-- Retrieves records from the Account table

-- =============================================

CREATE PROCEDURE GetAccounts

AS

      SELECT AccountID, CustomerName, Balance

      FROM Account

 

-- =============================================

-- Retrieves a single record from the Account

-- table using the AccountID, which is passed
-- as a parameter to the Stored Procedure

-- =============================================

CREATE PROCEDURE GetAccountByID

      @theID int

 

AS

      SELECT AccountID, CustomerName, Balance

      FROM Account

      WHERE AccountID = @theID

 

-- =============================================

-- Retrieves records from the Account table

-- using the CustomerName, which is passed
-- as a parameter to the Stored Procedure

-- =============================================

CREATE PROCEDURE GetAccountByName

      @theName varchar(50)

AS

      SELECT AccountID, CustomerName, Balance

      FROM Account

      WHERE CustomerName = @theName