I'm creating a SSRS report from a stored procedure in SQL, when i add a dataset to the report i'm finding i'm having to add this to the top of my procedure in order for fields to be returned into my data set from the stored proc:
IF 1=2 SELECT '' as [Date], '' as [Portfolio ID], '' as [Portfolio Base Ccy], 0 as [All in Market Value Base], 0 as [All in Market Value Converted]
Why would I have to do this and why does SSRS not simply pick up:
SELECT [Date], [Portfolio ID], [Portfolio Base Ccy], [All in Market Value Base], [All in Market Value Converted]
FROM @Worktable
from the bottom of my procedure or
SELECT * FROM @Worktable
?
EDIT: Ok i think i've narrowed down my issue in my procedure to the face that i have a debug parameter in my procedure. So if this parameter is set to 'Y' then i show each step of my procedure, which makes it easier for debugging (i can add an example if need be). Also at the end of my procedure i have an if statement for my final result set which says:
IF @ReportType IN ('SSD', 'TTD', 'STD')
BEGIN
SELECT.........
END
IF @ReportType IN ('SS', 'TT', 'ST')
BEGIN
SELECT.........
END
Could this be an issue as well?