Last active
October 23, 2015 20:04
-
-
Save sqlsimon/539168963a492bd37439 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
USE [msdb] | |
GO | |
CREATE view [dbo].[vwBackupHistory] | |
as | |
select | |
this_instance_name = @@SERVERNAME | |
,source_server_name = left(bs.server_name, 40) | |
,database_name = left(bs.database_name, 60) | |
,bs.type | |
,physical_device_name = left(bmf.physical_device_name, 120) | |
,bs.backup_start_date | |
,bs.backup_finish_date | |
,bs.backup_size | |
,backup_user_name = bs.user_name | |
from msdb..backupset bs | |
left outer join msdb.dbo.backupmediafamily bmf | |
on bmf.media_set_id = bs.media_set_id | |
left outer join msdb.dbo.restorehistory rh | |
on bs.backup_set_id = rh.backup_set_id | |
where | |
rh.backup_set_id is null | |
GO |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment