title: How to populate a dataset in SSRS from a stored proc
body: <p>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:</p>
  
  <pre><code>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]
  </code></pre>
  
  <p>Why would I have to do this and why does SSRS not simply pick up:</p>
  
  <pre><code>SELECT [Date], [Portfolio ID],   [Portfolio Base Ccy], [All in Market Value Base], [All in Market Value Converted]
  FROM @Worktable
  </code></pre>
  
  <p>from the bottom of my procedure or </p>
  
  <pre><code>SELECT * FROM @Worktable
  </code></pre>
  
  <p>?</p>
  
  <p>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:</p>
  
  <pre><code>IF @ReportType IN ('SSD', 'TTD', 'STD')
  BEGIN
  SELECT.........
  END
  
  IF @ReportType IN ('SS', 'TT', 'ST')
  BEGIN
  SELECT.........
  END
  </code></pre>
  
  <p>Could this be an issue as well?</p>