sql - How do capture the result set from RESTORE FILELISTONLY FROM DISK... so I can query it? -


How can I capture output from the following SQL statement so that I can query the resultset?:

  Restore FILELISTONLY to disk = N'DD: \ Restores \ MyBackup.BAK '' with shipping, file = 1  

Do I need to create a temporary table and then do something Like?:

  Reinstall the file with INSERT #tmp EXEC ('Discus = N''D: \ restores \ KevsProfilerTraces.BAK' ', with file = 1' 'Restore)  

May include forward to essentially Lojiklnam and PhysicalName column query for certain management functions.

Or is there any easy way?

If your argument is in T-SQL, then the only way is to use INSERT ... EXEC ... As you are already in your post, this can be a #temp table or it may be a table @ increment.

The other option is to transfer the argument from T-SQL into CLR processes or in the SSIS workflows.


Comments