Console login error "Invalid query attribute 'x' cannot reference attribute type 'x'..."

Version 2

    Problem

     

    An issue has been identified where by after saving a query in Query and Report Designer the following error message is displayed for all users:

     

    "Invalid query attribute 'x' cannot reference attribute type 'x'. For top-level query attributes it must relate to the class type of the query or one of its sub or super-classes. For related query attributes it must relate to the class type of the parent attributes related class type or one of its sub or super-classes."

     

    Cause

     

    The root cause of this issue has yet to be identified.  If you experience this error please contact your local Support and provide as much information as possible as to what query design change you were making at the time.  A copy of the Service Desk database in its broken state may also assist us.

     

    Solution

     

    Run the attached script for SQL or Oracle as required followed by an IIS reset.  The script will report which attributes on which queries are invalid and remove them automatically.  Those attributes will need to be re-added afterwards.