Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 Transact-SQL (2005)
 RESTORE question

Author  Topic 

BruceT
Yak Posting Veteran

78 Posts

Posted - 2010-09-08 : 11:49:53
Is there are way to return the results of a

RESTORE FILELISTONLY FROM DISK = 'somebackup.bak'

into a table?

I need to dynamically build a RESTORE into a new database without knowing beforehand what the logical and physical names are some backup file that's being downloaded from a different network.

Thanks

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-08 : 11:53:02
You can do it via dynamic SQL.

INSERT INTO ...
EXEC ('RESTORE ...')

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-09-08 : 11:54:09
I also googled it for you and found this: http://www.sqlservercentral.com/Forums/Topic455993-146-1.aspx#bm456011

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page
   

- Advertisement -