Must declare the scalar variable exception after upgrade
When upgrading your CMS from version 6 to version 7, you may experience the error: Must declare the scalar variable exception in CMS Desk and also within the Event log.
This issue only occurs for hotfixes below 7.0.19. You can fix this by running the following script on your database:
DELETE FROM [CMS_Query]
WHERE
[QueryName] IN ('selectall', 'deleteall', 'updateall', 'selectmodifiedfrom', 'select', 'delete', 'update', 'insert', 'insertidentity') AND
([QueryIsCustom] IS NULL OR [QueryIsCustom] = 0)AND
[QueryIsLocked] = 0 AND
[QueryTypeID] = 0;
DELETE FROM [CMS_Query]
WHERE
[QueryName] IN ('searchtree', 'selectdocuments', 'selectversions') AND
([QueryIsCustom] IS NULL OR [QueryIsCustom] = 0) AND
[QueryIsLocked] = 0 AND
[QueryTypeID] = 0 AND
[ClassID] IN (SELECT [ClassID] FROM [CMS_Class] WHERE [ClassIsDocumentType] = 1);
-db-
Applies to: Kentico CMS 7.x