Sql-server – SSRS: Error Getting the Fields And Parameters for a shared Dataset based on a Stored Procedure

sql serverssrsstored-procedures

I am using SSRS and adding a shared dataset based on a stored procedure with parameters. When I go to refresh the fields so Visual Studio adds the correct parameters and fields, sometimes I get the following error message:

Could not create a list of fields for the query. Verify that you can connect to the data source and that your query syntax is correct.

The detail message is

Procedure or function 'SP NAME' expects parameter '@parameter name', which was not supplied.

The problem happens quite randomly. Sometimes it works, other times it doesn't. Doesn't matter what is inside the stored procedure. Without the fields and parameter list, you can not add the data set to a report.

Thanks!

Best Answer

This error is due to the way Visual Studio Data Tools/BIDS/SSRS Designer to caches datasets. The workaround I found to get the fields and parameters refreshed correctly is as follows.

With a Shared Dataset Properties Window Open

  1. Hit Refresh Fields

  2. Close out the error msg.

  3. Click on Query Designer

  4. Click on the Exclamation Mark Button

  5. A define Query Parameters window should pop up. Put in values for the parameters. Good defaults to use are ones that return little to no data. You are just looking for SSRS to refresh the data set metadata.
  6. Hit Ok.
  7. Wait a bit until the query is done.
  8. Hit ok.
  9. Check to see if data is now in the fields and parameters list. It should be!

Please note: The error will pop up even after you do have fields and parameters listed. However, you just need to make sure it is up to date. The error message popping up is fine and will continue to pop up. When ever you need to refresh the shared data set, just follow the steps above.