﻿<?xml version='1.0' encoding='UTF-8'?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/"><channel><title>SQLServerCentral / SQL Server 2005 / SQL Server Express  / Copy rows returned from a RESTORE FILELISTONLY command into a tble / Latest Posts</title><generator>InstantForum.NET v2.9.0</generator><description>SQLServerCentral</description><link>http://www.sqlservercentral.com/Forums/</link><webMaster>notifications@sqlservercentral.com</webMaster><lastBuildDate>Wed, 22 May 2013 14:32:27 GMT</lastBuildDate><ttl>20</ttl><item><title>RE: Copy rows returned from a RESTORE FILELISTONLY command into a tble</title><link>http://www.sqlservercentral.com/Forums/Topic935609-324-1.aspx</link><description>I realize this post is old... but it helped me solved my issue with capturing RESTORE HEADERONLY data into a temp table.Cheers! :)</description><pubDate>Tue, 28 Aug 2012 13:29:55 GMT</pubDate><dc:creator>Patrick C. Joseph</dc:creator></item><item><title>RE: Copy rows returned from a RESTORE FILELISTONLY command into a tble</title><link>http://www.sqlservercentral.com/Forums/Topic935609-324-1.aspx</link><description>Perfect !!!   Thanks so much.   I am still learning all the ins and outs of SQL.   You help is deeply appreciated.</description><pubDate>Tue, 22 Jun 2010 09:34:35 GMT</pubDate><dc:creator>bryan.duchesne</dc:creator></item><item><title>RE: Copy rows returned from a RESTORE FILELISTONLY command into a tble</title><link>http://www.sqlservercentral.com/Forums/Topic935609-324-1.aspx</link><description>I think you're just missing the SET FMTONLY OFF setting SELECT a.* INTO #hdr FROM OPENROWSET('SQLNCLI','Server=(local)\SQLEXPRESS;Trusted_Connection=yes','EXEC(''SET FMTONLY OFF RESTORE HEADERONLY FROM DISK =''''c:\code3Billing\ClientSQLData\Master\code3billing.bak '''''')') AS a</description><pubDate>Tue, 22 Jun 2010 09:04:58 GMT</pubDate><dc:creator>steve-893342</dc:creator></item><item><title>RE: Copy rows returned from a RESTORE FILELISTONLY command into a tble</title><link>http://www.sqlservercentral.com/Forums/Topic935609-324-1.aspx</link><description>I would also like to do a similar thing with the HEADERONLY but when I try to clone your code I get an error.   Here is my code:SELECT a.* INTO #hdr FROM OPENROWSET('SQLNCLI','Server=(local)\SQLEXPRESS;Trusted_Connection=yes','EXEC(''SET FMT OFF RESTORE HEADERONLY FROM DISK =''''c:\code3Billing\ClientSQLData\Master\code3billing.bak '''''')') AS aHere is the error:Cannot process the object "EXEC('SET FMT OFF RESTORE HEADERONLY FROM DISK =''c:\code3Billing\ClientSQLData\Master\code3billing.bak ''')". The OLE DB provider "SQLNCLI" for linked server "(null)" indicates that either the object has no columns or the current user does not have permissions on that object.Am I missing something???</description><pubDate>Tue, 22 Jun 2010 07:25:34 GMT</pubDate><dc:creator>bryan.duchesne</dc:creator></item><item><title>RE: Copy rows returned from a RESTORE FILELISTONLY command into a tble</title><link>http://www.sqlservercentral.com/Forums/Topic935609-324-1.aspx</link><description>That works just great... Thank you for your input.  it is much appreciated.</description><pubDate>Tue, 22 Jun 2010 06:09:21 GMT</pubDate><dc:creator>bryan.duchesne</dc:creator></item><item><title>RE: Copy rows returned from a RESTORE FILELISTONLY command into a tble</title><link>http://www.sqlservercentral.com/Forums/Topic935609-324-1.aspx</link><description>If you embed your RESTORE FILELISTONLY in an EXEC statement, you can still use your OPENROWSET approach SELECT a.* INTO #tmp FROM OPENROWSET('SQLNCLI','Server=(local)\SQLEXPRESS;Trusted_Connection=yes','EXEC(''SET FMTONLY OFF RESTORE FILELISTONLY FROM DISK=''''C:\code3Billing\ClientSQLData\Master\code3billing.bak'''''')') AS a</description><pubDate>Tue, 22 Jun 2010 05:09:47 GMT</pubDate><dc:creator>steve-893342</dc:creator></item><item><title>RE: Copy rows returned from a RESTORE FILELISTONLY command into a tble</title><link>http://www.sqlservercentral.com/Forums/Topic935609-324-1.aspx</link><description>Hi,Not sure if this will help, but you should be able to achieve the same thing this way...[code]CREATE PROCEDURE usp_TestRestore ASBEGIN    RESTORE FILELISTONLY FROM DISK = 'c:\code3Billing\ClientSQLData\Master\code3billing.bak'ENDGOIF OBJECT_ID('tempdb..#Restore') IS NOT NULL DROP TABLE #RestoreCREATE TABLE #Restore (    LogicalName NVARCHAR(128),    PhysicalName NVARCHAR(260),    [Type] CHAR(1),    FileGroupName NVARCHAR(128),    Size NUMERIC(20,0),    MaxSize NUMERIC(20,0),     FileID BIGINT,     CreateLSN NUMERIC(25,0),     DropLSN NUMERIC(25,0),    UniqueID UNIQUEIDENTIFIER,     ReadOnlyLSN NUMERIC(25,0),    ReadWriteLSN NUMERIC(25,0),    BackupSizeInBytes BIGINT,     SourceBlockSize INT,     FileGroupID INT,     LogGroupGUID UNIQUEIDENTIFIER,    DifferentialBaseLSN NUMERIC(25,0),    DifferentialBaseGUID UNIQUEIDENTIFIER,     IsReadOnly BIT,     IsPresent BIT,     TDEThumbprint VARBINARY(32)  )   INSERT #Restore EXEC usp_TestRestore  SELECT * FROM #Restore[/code]</description><pubDate>Mon, 21 Jun 2010 16:32:14 GMT</pubDate><dc:creator>Jesse Reich</dc:creator></item><item><title>Copy rows returned from a RESTORE FILELISTONLY command into a tble</title><link>http://www.sqlservercentral.com/Forums/Topic935609-324-1.aspx</link><description>I am trying to copy the rows returned from a RESTORE FILELISTONLY command into a temp table so that I can get the current column structure so I can then query the results to further filter them.sp_configure 'Ad Hoc Distributed Queries', 1 GO RECONFIGURE GO SELECT a.* into #tmp FROM OPENROWSET('SQLNCLI','Server=(local)\SQLEXPRESS;Trusted_Connection=yes;','RESTORE FILELISTONLY FROM DISK =''c:\code3Billing\ClientSQLData\Master\code3billing.bak''') as abut I am getting an error Msg 7357, Level 16, State 2, Line 4Cannot process the object "RESTORE FILELISTONLY FROM DISK ='c:\code3Billing\ClientSQLData\Master\code3billing.bak'". The OLE DB provider "SQLNCLI" for linked server "(null)" indicates that either the object has no columns or the current user does not have permissions on that object.I have permissions since I can run the RESTORE command as a stand-alone.   I am sure there are columns since I can see them when I do run the command as stand-alone.Does anyone have any insight here?</description><pubDate>Thu, 10 Jun 2010 11:55:41 GMT</pubDate><dc:creator>bryan.duchesne</dc:creator></item></channel></rss>