Unable to delete content categories even where all related reports are deleted

Bernard Anderson shared this question 6 years ago
Answered

I have several 'historic' content sub categories which I would like to delete. However when I try I get a message that the 'Category is in use against n reports'

I have no active or draft reports in the sub-category or related category


How can I see what is stopping the deletion?

Replies (3)

photo
1

Hi Bernard,

run the following query:

SELECT * 
FROM ReportHeader 
WHERE SubCategoryCode = '<insert subcategory code here>' 
AND ReportStatusCode IN ('OPEN', 'DRAFT')

and if there are any reports in the result set, then after making sure that you really don't want them you can then delete them with the following:

UPDATE ReportHeader
SET ReportStatusCode = 'DELETED'
WHERE ReportId = <<span style="font-style: italic;">insert ReportId here</span>>

N.B. as we remind all clients who are going to modify their YF DB via the backend, please remember to back it up immediately beforehand.


Please let me know how you get on with this.0


regards,

David

photo
1

Thanks all gone,


Just so I remember subcategory code is from ORGREFERENCECODEDESC where SHORTDESCRIPTION is what you see on screen.


You may close this question down :)

photo
1

that's a good point Bernard, and also I'll just add (also for future reference) that the relevant rows from the OrgReferenceCodeDesc table are those

where RefTypeCode IN ('RPTCATEGORY', 'RPTSUBCATEGORY')


thanks,

David

Leave a Comment
 
Attach a file