1 Reply Latest reply on Aug 8, 2017 4:01 AM by Senta

    Find all places an attribute is used

    blwallace Apprentice

      I'm trying to delete an attribute I've created.  I keep getting

      Delete statement conflicted with the reference constraint "fkey$md_query_attribute$at".  The conflict occurred in database "blah", table "dbo.md_query_attribute", column 'md_attribute_type_guid'.  The statement has been terminated.


      I believe this is telling me there is a query which uses this attribute.  I can't find the query.  Is there a way to query the DB to find where this attribute is used?  An SQL script perhaps?

        • 1. Re: Find all places an attribute is used
          Senta SupportEmployee

          Hello blwallace,


          I cannot give you what you ask for in the Title of the question, but what you ask for in your question.


          Without guarantee to be fit for any purposes I list a SQL query which list all SQL query which list all Attributes used in Queries with the Class name below.

          The same information can be gained by a SD Query created in console, for wich I attached a SD 2017.1 Design Transfer document.


          SELECT qt.md_title [Query Name],
                 mat.md_name [Attribute Name],
                 mct.md_name [Attribute Class/Object],
                 mct.md_client_class [Full Class/Object Name]
          FROM md_query_template qt
               JOIN md_query_attribute qa ON qa.md_query_template_guid = qt.md_guid
               JOIN dbo.md_attribute_type mat ON qa.md_attribute_type_guid = mat.md_guid
               JOIN dbo.md_class_type mct ON mat.md_class_type_guid = mct.md_guid
          ORDER BY qt.md_title ASC;