How to find orphaned records by query on sys_attachment_doc table

bunnykiran94
Tera Contributor

Hi.

 

Can anyone help me in how to query the orphaned records on attachment document table? I have a requirement to pull all the orphaned records from sys_attachment_doc and clean up them.

8 REPLIES 8

bernyalvarado
Mega Sage

That sounds like a very risky operation! Why do you think that you have orpahan records in the attachments table? 

It's a very hard task to do because even OOB there's records in the attachment tables that are not associated to a record like an incident or problem or change, or request, etc... instead it could be associated to ts_ or sys_ tables that are for core to the platform.

Thanks,

Berny

HI Berny,

Thank you for your response, the table is sys_attachment_doc table not the sys_attachment table.

 

Regards,

Bhanu

Oh! that will be very simple then... you just need to filter for the records which the sys attachment field is empty.

SaiRaviKiran Ak
Giga Guru

Go through the below link to get better idea about attachments:

 

https://snprotips.com/blog/2016/2/25/understanding-and-using-glideattachment

 

Mark Correct if it solves your issue.

 

Thanks,

Ravi