问题
How to insert a few more columns into the dbFileListOnly
table along with EXEC query:
INSERT INTO admindb..dbfilelistonly (path, col1, col2....)
@path, EXEC ('RESTORE FILELISTONLY FROM DISK = ''' + @path + '''')
I don't know if it is possible or not. I want to save database name along with fileListHeader
so that I know while restoring which files belong to a given database.
回答1:
OPENROWSET
is a tricky way but may comfort you. It allows even to join sp results with other tables.
https://msdn.microsoft.com/en-us/library/ms190312%28v=sql.120%29.aspx
来源:https://stackoverflow.com/questions/35428540/insert-into-table-the-result-from-stored-procedure-plus-extra-columns