• Just off the top of my head, I'd do something like below ... if no backup date appears, then there was no full backup after the last restore.

    SELECT tdb.*, rh.restore_date AS Last_Restore, bs2.backup_finish_date AS Backup_After_Restore

    FROM dbo.tUserDBs tdb

    OUTER APPLY (

    SELECT TOP (1) *

    FROM msdb.dbo.restorehistory rh2

    WHERE

    rh2.destination_database_name = tdb.DBName AND

    (rh2.restore_type IS NULL OR rh2.restore_type <> 'V')

    ORDER BY restore_history_id DESC /*presumably accurate rather than datetime*/

    ) AS rh

    OUTER APPLY (

    SELECT TOP (1) *

    FROM msdb.dbo.backupset bs2

    WHERE

    bs2.database_name = tdb.DBName AND

    bs2.is_copy_only = 0 AND

    bs2.is_snapshot = 0 AND

    bs2.type = 'D' AND

    bs2.backup_finish_date > rh.restore_date

    ORDER BY backup_set_id DESC /*presumably accurate vs datetime*/

    ) AS bs2

    SQL DBA,SQL Server MVP(07, 08, 09) "It's a dog-eat-dog world, and I'm wearing Milk-Bone underwear." "Norm", on "Cheers". Also from "Cheers", from "Carla": "You need to know 3 things about Tortelli men: Tortelli men draw women like flies; Tortelli men treat women like flies; Tortelli men's brains are in their flies".