SQLTeam.com | Weblogs | Forums

Transact query to SSRS


#1

Hi,

I am new to SQL and have been making progress with simple queries. Some of the queries I have been running are
parameter queries.

I understand that a parameter must be declared for the parameter to work and have successfully written a simple query that does this:

DECLARE
@CompName Varchar (30)
SET @CompName ='MJM%'

SELECT [Company Name], [Contact Source]
FROM tbcontacts
WHERE [Company Name] Like 'MJM%';

The problem I am having now is how do I export this a:

  1. Stored Procedure
  2. Allowing people to access this via a web interface.

I need simple step by step instructions if possible or a link to where I can find these type of instructions.

Thank you in advance for your assistance.

MarkA


#2

The stored procedure:

CREATE PROCEDURE GetCustNameAndSource @CompName VARCHAR(30)
AS
BEGIN
     SELECT [Company Name]
          , [Contact Source]
     FROM tbcontacts
     WHERE [Company Name] LIKE @CompName;
END

Using SSRS, you set up an SSRS parameter that you pass to the stored procedure (above). When you publish the report and people run it, they will need to fill in the parameter in order to run the report.