I have a query that runs fast in SSMS but runs very slow in SSRS and As I was searching for a solution, I came about this solution below provided by user275554
"Thanks for the suggestions provided here. We have found a solution and it did turn out to be related to the parameters. SQL Server was producing a convoluted execution plan when executed from the SSRS report due to 'parameter sniffing'. The workaround was to declare variables inside of the stored procedure and assign the incoming parameters to the variables. Then the query used the variables rather than the parameters. This caused the query to perform consistently whether called from SQL Server Manager or through the SSRS report".
My Problem is that I tried assigning parameters to the variables but it seems I really don't know how to do it so the report didn't produce any data.
An example of what I tried is this:
CREATE PROC MissingData
AS
DECLARE @Office varchar (200)
DECLARE @employee varchar (100)
SET @Office = @Office -- @office is the parameter from SSRS
SET @employee = @employee-- @employee is the parameter FROM SSRS
Can someone help me on how to assign the parameter to use the variables as provided by the solution.
Thanks Mi