
/* Code Fragment 9.25 Temporally vacuum unused entities from the archival store. */

DELETE FROM P_TT_PAST
WHERE DATEDIFF(day,Stop_Date,GETDATE()) > 730
AND NOT EXISTS (SELECT *
		FROM  P_TT_CURRENT
		WHERE P_TT_PAST.PROJECTION_ID = P_TT_CURRENT.PROJECTION_ID)
