-- ===================================================== ===============-- Used in SQL Server 2008 and SQL Server 2008 r2declare @ databbasebakpath nvarchar (500) set @ databbasebakpath = 'backup path' declare @ bakfilelist2008 table (logicalname nvarchar (128), physicalname nvarchar (260), type char (1), filegroupname nvarchar (128 ), size numeric (), maxsize numeric (), fileid bigint, createlsn numeric (), droplsn numeric () null, uniqueid uniqueidentifier, readonlylsn numeric () null, readwritelsn numeric (25, 0) null, comment bigint, sourceblocksize int, filegroupid int, loggroupguid uniqueidentifier null, comment numeric (25, 0) null, comment uniqueidentifier, isreadonly bit, ispresent bit, tdethumbprint varbinary (32) insert into @ bakfilelist2008 exec sp_executesql n 'Restore filelistonly from [email protected] ', n' @ databbasebakpath nvarchar (260)', @ databbasebakpath select * From @ response
-- ===================================================== ===============-- Used in SQL Server 2005 declare @ databbasebakpath nvarchar (500) set @ databbasebakpath = 'backup path' declare @ bakfilelist2005 table (logicalname nvarchar (128), physicalname nvarchar (260), type char (1), filegroupname nvarchar (128 ), size numeric (), maxsize numeric (), fileid bigint, createlsn numeric (), droplsn numeric () null, uniqueid uniqueidentifier, readonlylsn numeric () null, readwritelsn numeric () null, comment bigint, sourceblocksize int, filegroupid int, loggroupguid uniqueidentifier null, comment numeric () null, comment uniqueidentifier, isreadonly bit, ispresent bit) insert into @ bakfilelist2005 exec sp_executesql n 'Restore filelistonly from [email protected] ', n' @ databbasebakpath nvarchar (260)', @ databbasebakpath select * From @ bakfilelist2005