Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How to access the result set

Status
Not open for further replies.

lgh

MIS
Dec 4, 2000
1
SG
After executing restore database with the filelistonly option. It should returns a result set. How do I access this result set to retrieve all the rows for further processing in a stored procedure ????
 
Very Good Question... Try this, I have tested it and it works...

DECLARE @exec_str varchar(256)

CREATE TABLE #mytable
(
LogicalName nvarchar(128),
PhysicalName nvarchar(260),
Type char(1),
FileGroupName nvarchar(128),
Size numeric(20,0),
MaxSize numeric(20,0)
)


SET @exec_str = "RESTORE FILELISTONLY FROM DISK = 'F:\MSSQL7\BACKUP\pubs2.bak'"

INSERT #mytable
EXEC(@exec_str)

select *
from #mytable

Thanks,

Tom ;-)
 
Of course, replace your backup device with the appropriate value...

:)

Tom
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top