Category=coptot - Database Maintenance
Name=80. Clear- Page imported data from PAGE
Description=Clear Imported Page Data from PAGE
SQL=delete from PAGE where (DOCUMENTID, PAGEID) in (SELECT DOCUMENTID, PAGEID from (SELECT P.DOCUMENTID, P.PAGEID from PAGE P \
WHERE not exists(SELECT 1 from SURROGATEIMAGE SI where SI.DOCUMENTID=P.DOCUMENTID and SI.PAGEID=P.PAGEID) \
and not exists(select 1 from BIBLICALCONTENT BC where BC.DOCUMENTID=P.DOCUMENTID and BC.PAGEID=P.PAGEID)) X)

SQL2=delete from SHELFINSTANCEPAGES where (DOCUMENTID, PAGEID) in (SELECT DOCUMENTID, PAGEID from (SELECT SIP.DOCUMENTID, SIP.PAGEID from SHELFINSTANCEPAGES SIP \
WHERE not exists(SELECT 1 from PAGE P where SIP.DOCUMENTID=P.DOCUMENTID and SIP.PAGEID=P.PAGEID)) X)

