Delete unused Practice Areas

Delete unused Practice Areas

The following SQL script will delete unused practice areas.

  1. --Delete any practice areas that are not used
  2. UPDATE
  3. __M_Matters_PracticeAreas
  4. SET
  5. Final_Status = 'Deleted'
  6. WHERE 1=1
  7. AND Id NOT IN(
  8. SELECT
  9. Final_PracticeArea_Id
  10. FROM
  11. __M_Matters
  12. WHERE
  13. Final_Status != 'Deleted'
  14. )

    • Related Articles

    • Synthesize Missing Practice Areas

      The following SQL script will create practice areas where they do not exist in the Matters table. --Synthesize missing practice areas from Matters INSERT INTO __M_Matters_PracticeAreas( Id, Final_Subject ) SELECT DISTINCT Final_PracticeArea_Id, ...
    • Convert a Custom Field into a Practice Area

      --The system we are coming from does not have practice areas --however, the client has created a picklist custom field that mimics this. --We are going to convert this custom field into a practice area. --First, populate the practice areas table with ...
    • Audit Scripts: General Audit

      After completing a backup there are a number of things that are good to review prior to restoring into the destination system. The script below reviews several of the data points that should be looked at prior to restoring. This script is not ...
    • Promoting Document Versions into Documents

      --The following playbook is a TEMPLATE that you can use to promote all document versions into actual documents. --When a document has a category, append the folder with the document category ID. UPDATE __M_Documents_Digital_Files SET --Prepend the ...
    • Audit Scripts: Row Counts and Progress Monitoring

      This article shows you a script that can be used to monitor the progress of both a Backup and a Restore. It can also be used to just review row counts on all the Universal Database tables. The first code block is used to populate a SQL Server Temp ...