Page 1 of 1

Scipt to edit database values?

PostPosted:Tue May 15, 2018 1:49 pm
by dferguson
I would like to bulk remove subscriptions to documents based on their parent folder.

I am using this to delete the subscription to an individual document based on the UUID.
Code: Select all
DELETE FROM OKM_NODE_SUBSCRIPTOR WHERE NSB_NODE = 'a621eb44-3136-467f-8848-de904147f709';
This works well, but I have an entire folder full of documents that needs to have there subscriptions removed. Can I write a script to poll the data base to get the UUIDs of all the files in a specific folder, then create a while loop to insert those UUIDs into the above code to loop through the removal process?

Re: Scipt to edit database values?

PostPosted:Tue May 15, 2018 2:58 pm
by dferguson
I think I accomplished the same result by the following....
Code: Select all
SELECT NSB_NODE, NBS_NAME FROM OKM_NODE_SUBSCRIPTOR inner join OKM_NODE_BASE on OKM_NODE_SUBSCRIPTOR.NSB_NODE = OKM_NODE_BASE.NBS_UUID where NBS_PARENT = '46209ab6-4629-4d39-978d-935f993fa3f8';
to verify I had the correct list. Then the following to delete the entries...
Code: Select all
DELETE OKM_NODE_SUBSCRIPTOR FROM OKM_NODE_SUBSCRIPTOR inner join OKM_NODE_BASE on OKM_NODE_BASE.NBS_UUID = OKM_NODE_SUBSCRIPTOR.NSB_NODE =  where NBS_PARENT = '46209ab6-4629-4d39-978d-935f993fa3f8';
Then to remove the subscriptions sent messages, which we use to create reports for our quality assurance procedures.
Code: Select all
DELETE OKM_PROP_SUB_RECEIVED FROM OKM_PROP_SUB_RECEIVED inner join OKM_NODE_BASE on OKM_NODE_BASE.NBS_UUID = OKM_PROP_SUB_RECEIVED.PSR_NODE where PSR_FROM ='jmcnaughton' and NBS_PARENT = '46209ab6-4629-4d39-978d-935f993fa3f8';

Re: Scipt to edit database values?

PostPosted:Thu May 17, 2018 5:59 am
by jllort
Seems right