Article ID: 2796721 - View products that this article applies to.
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:
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 scriptStart Windows PowerShell, and then execute the following commands. Make sure that you replace any placeholders with the parameters that reflect your environment.
$RptSrv = gwmi -Namespace "root\Microsoft\SqlServer\ReportServer\<RS_INST>\v11\Admin" -Class "MSReportServer_ConfigurationSetting"
$Res = $RptSrv.GenerateDatabaseCreationScript("<ReportServer>", 0, 0)
$Res.Script | Set-Content "<c:\output\dbcreation2005.sql>"
Step 2: Generate the upgrade scriptUse the same Windows PowerShell window that you opened in step 1 to execute the following two commands:
$Res = $RptSrv.GenerateDatabaseUpgradeScript("<ReportServer>","C.0.9.45")
$Res.Script | Set-Content "<c:\output\dbupgrade2005.sql>")
Step 3: Run the creation script manually
Step 4: Change the upgrade script to remove the incorrect statementsOpen the script that you generated in step 2 in a text editor of your choice, and then change the following statements as indicated in the following table.
Collapse this tableExpand this table
Step 5: Run the upgrade script manuallyIn the instance of SQL Server Management Studio that you started in step 3, open and then execute the upgrade script that you changed in step 4.
Step 6: Configure the Reporting Services service to use the newly created database.
Article ID: 2796721 - Last Review: December 31, 2012 - Revision: 1.0