Display Stored procedure in SSRS Report

Closed - This job posting has been filled and work has been completed.

Job Description

Hi,
I have a stored procedure (file attached) that get result dynamically.
For example if :
@startDate = 1/1/2013
@EndDate = 5/5/2014
@month= 1,2,3,4
@service = 1

Columns in result will be :
companyid 2014 2013 14v13% 14v13


Exemple 2 :
------------------
if :
@startDate = 1/1/2012
@EndDate = 5/5/2014
@month= 1,2,3,4
@service = 1

Columns in result will be :
companyid 2014 2013 2012 14v13% 14v13 14v12 14v12 13v12% 13v12

etc...


I think the main part to change is this one:

SET @cols = Stuff((SELECT ',' + Quotename(c.columnheader)
FROM #Calcs c
GROUP BY c.columnheader
ORDER BY c.columnheader DESC
FOR XML PATH(''), TYPE).value('.', 'NVARCHAR(MAX)'), 1, 1, '')
SET @query = 'SELECT companyid, ' + @cols
+ ' from ( select u.companyid, Value, columnheader from #Calcs u ) x pivot ( sum(Value) for columnheader in ('
+ @cols + ') ) p '

EXECUTE(@query)


you would need to give a name in order to put in a matrix in ssrs

Open Attachment

Other open jobs by this client