DECLARE @RestoreFilesCmd varchar( 8000 );
CREATE TABLE #RestoreFiles (
        LogicalName nvarchar(128) ,
        PhysicalName nvarchar(260) ,
        Type char(1) ,
        FileGroupName nvarchar(128) ,
        [Size] numeric(20,0) ,
        [MaxSize] numeric(20,0)
); 
SET @RestoreFilesCmd = 'RESTORE FILELISTONLY FROM DISK = ' + 
                        QUOTENAME( 'G:\pubs_db_200009110400.BAK' , '''' );
PRINT @RestoreFilesCmd;
/*
RESTORE FILELISTONLY FROM DISK = 'G:\pubs_db_200009110400.BAK'
*/
INSERT INTO #RestoreFiles EXECUTE ( @RestoreFilesCmd );
SELECT * FROM #RestoreFiles;
/*
LogicalName  PhysicalName                          Type FileGroupName Size         MaxSize
------------ ------------------------------------- ---- ------------- ------------ --------------
pubs         d:\mssql7\data\pubs_standby_data.mdf  D    PRIMARY       55083270144  35184372080640
pubs_log     d:\mssql7\data\pubs_standby_log.ldf   L    NULL          471662592    35184372080640
*/
GO
DROP TABLE #RestoreFiles;
GO
This page was last updated on May 01, 2006 04:28 PM.