Hi,
I was chasing my tail for a while in Monitoring > Health > Content data > Wrong Item Ids. It seems to constantly hang and log an error in the event viewer.
After looking into this I notice it's because of the Item Type system names with dashes (i.e. "Swift_2Columns_9-3"). I tracked down the code to be in ContentDataHealthProvider.cs , method ExecuteCheck10_WrongItemIds. All that's needed is within the while, wrap the table name in square brackets (below in red).
Can this please be fixed?
private static void ExecuteCheck10_WrongItemIds(Check check) { var commandBuilder = new CommandBuilder(); commandBuilder.Add(@"SELECT [ItemType], [Current] FROM [ItemTypeId] WHERE EXISTS (SELECT * FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = CONCAT('ItemType_', [ItemType]))"); var isFirst = true; var itemCommandBuilder = new CommandBuilder(); itemCommandBuilder.Add("SELECT TOP 100 * FROM ("); var isTableExists = Database.ExecuteScalar(CommandBuilder.Create("SELECT 1 FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_NAME = 'ItemTypeId'")); if (Converter.ToInt32(isTableExists) == 1) { using (var reader = Database.CreateDataReader(commandBuilder)) { while (reader.Read()) { if (!isFirst) { itemCommandBuilder.Add("UNION"); } isFirst = false; var itemType = reader.GetString(0); var currentItemId = reader.GetInt32(1); itemCommandBuilder.Add($"SELECT TOP 1 '{itemType}' ItemType FROM [ItemType_{itemType}]"); itemCommandBuilder.Add("WHERE CAST([Id] AS INT) > {0}", currentItemId); } } itemCommandBuilder.Add(") t"); } if (isFirst) { check.CheckWhatWasRun = commandBuilder.ToString(); check.Count = 0; check.State = CheckState.Ok; } else RunDatabaseCheck(check, itemCommandBuilder, "ItemType", "", "", "ItemTypeId"); }
Nuno Aguiar