Extracting a field from RESTORE HEADERONLY
13
votes
7
answers
21646
views
I'm trying to use 'RESTORE HEADERONLY ' to get the date when the backup I'm about to restore was made.
The command:
RESTORE HEADERONLY FROM DISK = ''
works fine in Query Analyzer and gives a resultset with something like 50 columns.
The problem is actually accessing this from code.
I can get this into a temp table by declaring every single one of the 50:ish columns, inserting into it with
exec
and getting the value I want from there.
The problem is that I really want to avoid having to declare the entire resultset as a temp table as it seems like a very brittle solution if they ever add columns to it in future versions.
Is there any way to just get a single column out of this resultset without declaring all the columns?
Asked by alun
(233 rep)
Feb 8, 2012, 07:52 AM
Last activity: Aug 6, 2025, 10:44 AM
Last activity: Aug 6, 2025, 10:44 AM