Fix for error in upd_online_VersionControlDev11CTP3_CodeChurn.sql

If you upgrade your TFS 2010 server to TFS 2015.2 and have Reporting Services enabled, you may discover the following error in your event log after the upgrade:

TF400797: Job extension had an unhandled error: Microsoft.TeamFoundation.Framework.Server.SqlScriptException: 1 error(s) occurred while executing upd_online_VersionControlDev11CTP3_CodeChurn.sql script. Failed batch starts on line: 1. Error: 206, Level: 16, State: 2, Batch Line: 0, Script Line: 0 Message: Operand type clash: varchar is incompatible with typ_KeyValuePairStringTableNullable

This bug only affects users who upgrade from TFS 2010 directly to TFS 2015.2, 2015.2.1 (and maybe 2015.1).  It is is fixed in TFS 2015.3.

To workaround the issue, run this SQL script against your TFS Collection database that is reporting the issue.

DECLARE @partitionId INT = 1
DECLARE @registryUpdates typ_KeyValuePairStringTableNullable
INSERT  @registryUpdates ([Key], Value)
SELECT  '#\Configuration\VersionControl\CodeChurn\InUpgrade\', NULL
EXEC prc_UpdateRegistry @partitionId, @registryUpdates
DROP TABLE tbl_UpgradeCodeChurn