Field list is empty when calling stored procedure

  • Hello!

       I am having problems retrieving list of fields when using stored procedure as Dataset Source. I noticed that Reporting Services can retrieve field list if stored procedure is trivial (simple select etc.). In my case, I am insrting into temporary table and after some manipulations return resultset. SQL Trace show that RS tries to execute SET FMTONLY ON <sp_name> SET FMTONLY OFF when reading list of the fiels. This returns empty result for my stored procedure.  

       I can not move any further without field list being populated properly. I can try to replace stored procedure with the view etc. but I would really like to know if someone experienced similar problems.

       Any help is greately appreciated,

    Igor

     

  • I think this is a known issue.  You can work around it by writing a dumy statement that has field names which populates the list and then swap your stored proc back in.  the dummy statement just has to be valid, it doesn't even have to hit a table e.g.

    SELECT 'a' AS [My_First_ColName], 1 AS My_Int_Col_Name, 1 AS My_Second_Int_Col_Name

     

    Steve.

  • Another option is to execute the query from the data tab and then click the refresh button.  The field list will then be available.

    Dave

  • And dont forget the

    set nocount on

    at the start of the PS.

    HABIB.

     


    Kindest Regards,

    Habib Zmerli (MVP)

  • I add set nocount on  to all my procs

     

  • I did execute procedure in the Data tab but field list didn't appear.

  • Thanks, Steve. I am creating all fields manually. The problem is that I have to remember not to click on Refresh button next time I edit report because it will cause fields to disappear.

  • I was looking for a solution to my problem, almost identical to the one posted here.  I did everything that was suggested but I'm not able to populate my report.  The one difference I have is that when on the data tab I run my SP and I get results back.  When I go to the preview tab, I get the following warning: 

    The data set ‘Gainsharing’ contains a definition for the field ‘id’. This field is missing from the returned result set from the data source.

    If I remove the field 'id', I get the same warning except that it warns on the next (now first) field.

    Any help would be appreciated.

    Frank

  • Frank,

     

      It's been a while. If I recall correctly, I have created fields manually. I was able to design/execute report. One thing to keep in mind is that once you refresh dataset in data tab, manually created fields disappear. This is as much as I can say.

     

    HTH,

    Igor

     

     

  • Igor,

    I found my problem, maybe yours is related.

    One of my fields was listed as Fields!StartTimeOfReport.Value.  Within the table where I was using this field I did the following.  In the textbox, I deleted the =Fields!StartTimeOfReport.Value expression.  I then replaced it with

    =First(Fields!StartTimeOfReport.Value, "Gainsharing").  I then went to the preview page and my report populated correctly, other then the textbox that I changed, every row had the First value.  I then went back to the design window and changed the textbox expression back to

    =Fields!StartTimeOfReport.Value and ran the report and it still worked great.

    I know at one time I had a different dataset used for the source in my table.  I changed it in the properties page, but I suspect that something in the report did not get changed and it couldn't resolve something.  By expressly pointing a table element to the

    First(Fields!StartTimeOfReport.Value, "Gainsharing") I reset whatever was hung up.

    I hope this is clear and understandable.

    Frank

Viewing 10 posts - 1 through 9 (of 9 total)

You must be logged in to reply to this topic. Login to reply