I'm trying to use 'RESTORE HEADERONLY' to get the date when the backup I'm about to restore was made.
RESTORE HEADERONLY FROM DISK = '<path to .bak file>'
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 temptable 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 temptable 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?