Wednesday, May 30, 2012

Linked dataset in report does not show new columns added in database

Using Visual Studio 2008 to develop the report, SQL server 2008 R2.to host the database and the reporting services.

Problem

The problem occurred in a report that uses a link to a shared dataset, which is based based on a stored procedure in SQL server. The stored procedure uses input parameters to select data from a view and returns the dataset. The table on which the view is based has been altered with some new columns. The view was altered to select those columns. The stored procedure used a ‘SELECT * FROM view’ and showed the new columns after testing in SQL server management studio. The shared dataset was updated with the Refresh Fields button to show the new fields. The fields did become available in the fields list of the shared dataset. But with the report in the designer of VS2008, and with after refreshing the fields of the linked dataset, no new fields were available.

Report –> linked dataset –> shared dataset –> stored procedure –> view –> table.

Solution

The select statement in the stored procedure was modified to select each column from the view by name.

Instead of using

SELECT * FROM view

The statement was altered to

SELECT field1, field2, field3, … FROM view

After saving the changes in the stored procedure, the refresh fields in the linked dataset design gave all new fields.

No comments: