Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 backup question

Author  Topic 

lols
Posting Yak Master

174 Posts

Posted - 2008-03-25 : 08:00:43
Hi,

I want to find which date my database was backed up and how many days ago. I want T-SQL command. Thank you

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2008-03-25 : 08:02:41
Make use of RESTORE HEADERONLY

Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

lols
Posting Yak Master

174 Posts

Posted - 2008-03-25 : 08:20:55
Thanks,

Can we query this info using the master.dbo.sysdatabases as I would eventually need to find out backup info of all databases.

thanks.
Go to Top of Page

PABluesMan
Starting Member

26 Posts

Posted - 2008-03-25 : 12:39:46
Actually, the backup history is stored in the [backupset], [backupfile], [backupfilegroup], [backupmediafamily] and [backupmediaset] system tables in the [msdb] database. However, the validity of this history is dependent on a number of factors: retention settings in SQL Agent, that sort of thing.
Go to Top of Page
   

- Advertisement -