Monday, May 2, 2011

rsInvalidDataSourceReference on a Microsoft SQL Server Reporting Services Report


When you deploy reports that were working on one SQL Server Report Server to another without Visual Studio or BIDS you sometimes get errors like: The report server cannot process the report or shared dataset. The shared data source 'MyDataSource' for the report server or SharePoint site is not valid. Browse to the server or site and select a shared data source. (rsInvalidDataSourceReference). This typically does not occur on Development environment because developers use Visual Studio to deploy reports. However, when same reports are deployed to QA or Production environment such errors frequently occur.
Problem is that giud that are referring to data sources are different in different versions of the database.
Execute following script against ReportServer database:
select *
from dbo.DataSource ds
where ds.link is null

The following script may resolve your problem. Again, you have to execute against Reporting Server database. If you are happy with results replace rollback with commit statement:

begin tran
update dbo.DataSource
set Link = c.ItemID
from dbo.DataSource ds
inner join dbo.Catalog c
on ds.Name = c.Name
and c.Type = 5
where ds.link is null

select ds.Link oldlink, c.ItemID
from dbo.DataSource ds
inner join dbo.Catalog c
on ds.Name = c.Name
and c.Type = 5
--where ds.link is null


select *
from dbo.DataSource ds
where ds.link is null

rollback tran
-- commit tran

2 comments:

  1. i have same problem. i build dev environment and paste all the reports from prod as well as datasource to make mirror copy so it can be test as prod. i change pointer in Data source in dev and also test it out. but when i try to run the report which been copy from prod shows me that error.

    can you please tell me more on what name needs to be change before running in my environment since i am not a SQL person. do i have to run those queries on Projectserver_Reporting Data base and what name would i need to change in that script.
    Thank you in advance
    Rav

    ReplyDelete
  2. Thank you for topic! It is really helpfull!

    ReplyDelete