I created a report in SSRS using a query with parameters and it worked fine. But I decided to use a stored procedure instead so that if ever there is any changes needed, it would only need to be applied to SSMS and not both SSMS and the query in SSRS.
So I created a stored procedure like seen below:
USE [Some_Database]
GO
CREATE PROCEDURE MyReport
AS
DECLARE @p_ServerName nvarchar(10) = 'all'
DECLARE @p_Env nvarchar(10) = 'all'
DECLARE @p_EnvCat nvarchar(10) = 'all'
SELECT DISTINCT <rest of my query...>
This is a greatly shortened version of what I am using but the ordering of the keywords is accurate. When I preview the report it in SSRS I get my No Rows Message.
Can anyone see what I did wrong in the creation of the stored procedure?
Also does using a stored procedure require different parameter setup in SSRS than if using a query?
Cheers.
UPDATE: After putting paramters between CREATE and AS and removing DECLARE, it works in SSRS for specific values but when I choose "ALL" it does not.
Any ideas?