January 6, 2011 at 8:55 am
I am trying to determine if a given database has a valid backup. My
first attempt at determining this was to simply query the
msdb..backupset system table and see if the DBs' name in question was
in the table. But then I ran upon a circumstance where the DB was
deleted and re-created without deleting its corresponding backup
information. So the above query showed the DB had a backup but that
was not the case. So I decided to use the database guid that is in the system table backupset instead.
However I am unable to find anywhere in T-SQL to find this value. I
have found it using a VB program and SQL Management Objects (SMO).
The database guid is a property of the database class.
So my question is how do I get the database guid from T-SQL and/or how
to determine if a given database has a valid database backup.
January 6, 2011 at 9:30 am
There's a database creation date column in that table. Have you tried comparing that to sys.databases to check if they match?
- Gus "GSquared", RSVP, OODA, MAP, NMVP, FAQ, SAT, SQL, DNA, RNA, UOI, IOU, AM, PM, AD, BC, BCE, USA, UN, CF, ROFL, LOL, ETC
Property of The Thread
"Nobody knows the age of the human race, but everyone agrees it's old enough to know better." - Anon
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply