After you create a Microsoft SQL Service Reporting Services (SSRS) 2012 database against a Microsoft SQL Server 2005 database engine from SQL Server Configuration Manager, you receive the following error message when you browse the ReportServer or ReportManager databases:
The version of the report server database is either in a format that is not valid, or it cannot be read. The found version is '143'. The expected version is '162'. (rsInvalidReportServerDatabase)
This issue occurs because of a problem with the script that is generated to upgrade the newly created database to the correct schema version. Specifically, the upgrade script contains in-line value assignments that are not supported for SQL Server 2005. (However, the statements are supported for SQL Server 2008 and later versions.)
To resolve this issue, you can manually generate the database creation scripts and upgrade scripts and then change them to remove the incorrect statements before you execute them to create and upgrade the ReportServer databases.
The in-line value assignments in the upgrade scripts should be broken down into two statements so that the declaration and the assignment are separate.
SQL Server Configuration Manager relies on WMI calls to generate the database creation script. Configuration Manager does this by internally calling the GenerateDatabaseCreationScript method. This works as expected, and the database is created correctly on the instance of SQL Server 2005. After this occurs, the SSRS service checks the database schema version during the service start. If it is required, the SSRS service then generates an update script whose purpose is to upgrade the database to the correct version.
This procedure currently fails on instances of SQL Server 2005 because of incorrect statements in the Transact-SQL script that is generated for the upgrade. The upgrade script contains in-line value assignments in statements such as the following:
declare @maxCleanCount int = 200;
In-line assignment together with the declaration is not supported in SQL Server 2005.
To resolve this issue, generate the upgrade script manually, remove the unsupported statements, and then run the script manually to upgrade the database. You can do this by accessing the Reporting Services WMI Provider and then calling the appropriate methods for generating the script.
The detailed procedure for resolving this issue is as follows.
Step 1: Generate the creation script
Start Windows PowerShell, and then execute the following commands. Make sure that you replace any placeholders with the parameters that reflect your environment.
The placeholder <RS_INST> represents the name of the instance of SSRS that is installed in your environment. To obtain this name if you don’t know it already, you can use the WBEMTest tool, connect to root\Microsoft\SqlServer\ReportServer, click Query, and then execute the following query:
Select * from __namespace
This will list the Reporting Services instances on your computer. You can then use the appropriate instance that corresponds to your SSRS 2012 service.
The placeholder <ReportServer> represents the name of the database that you want to create on the instance of SQL Server 2005.
The placeholder <c:\output\dbcreation2005.sql> represents the full path of the output file that will contain the creation script.
Step 2: Generate the upgrade script
Use the same Windows PowerShell window that you opened in step 1 to execute the following two commands: