Comments
2 comments
-
The first line would become (hopefully I've put enough quotes in, need to escape the escaped quotes!):
SET @SQL = 'master..sqlbackup ''-SQL "RESTORE HEADERONLY FROM DISK = ''''' + @backupFile + ''''' WITH SINGLERESULTSET"'';'
This will return the first result set (the HEADERONLY contents) but discard the second result set (the success status).
Hope that helps,
Jason -
Fantastic! That worked like a charm.
Thank you,
-Matt
Add comment
Please sign in to leave a comment.
For example, with a Native SQL backup I can do:
This of course fails when I try to something similar with master..sqlbackup because it has two different datasets that come back: one with the header information and the other with the success/failure information.
Can anyone give me some direction on how to handle this output or have an alternate way to retrieve the database name?
Thanks,
-Matt