PlotDirector/Docs/Investigations/Writer2Audit/RecoveryCoverage.readonly.sql

5 lines
749 B
SQL

SET NOCOUNT ON;
SELECT COUNT_BIG(*) AS RestorePoints,SUM(CASE WHEN COALESCE(JSON_QUERY(JsonData,'$.recovery.paragraphManuscripts'),JSON_QUERY(JsonData,'$.Recovery.ParagraphManuscripts')) IS NOT NULL THEN 1 ELSE 0 END) AS WithParagraphCollection FROM dbo.ProjectRestorePoints;
SELECT COUNT_BIG(*) AS ParagraphSnapshotsInRestorePoints FROM dbo.ProjectRestorePoints p CROSS APPLY OPENJSON(COALESCE(JSON_QUERY(p.JsonData,'$.recovery.paragraphManuscripts'),JSON_QUERY(p.JsonData,'$.Recovery.ParagraphManuscripts'))) j;
SELECT COUNT_BIG(*) AS RestorePointsWithSceneSourceCollection FROM dbo.ProjectRestorePoints WHERE COALESCE(JSON_QUERY(JsonData,'$.recovery.sceneManuscriptSources'),JSON_QUERY(JsonData,'$.Recovery.SceneManuscriptSources')) IS NOT NULL;