troubleshooting Question

sql restore from 2 .bak files

Avatar of cheryl9063
cheryl9063Flag for United States of America asked on
Microsoft SQL Server 2008Microsoft SQL Server 2005
2 Comments1 Solution546 ViewsLast Modified:
What is the correct syntax. I need to restore one database called hat but I have 2 .bak files that need to be restored for 1 database. See my code below.. What is the correct way to write this?

RESTORE FILELISTONLY FROM disk = N'E:\Backups\hat0.bak'

RESTORE FILELISTONLY FROM disk = N'E:\Backups\hat1.bak'
 
-- Perform the restore of the database from the backup file.  
-- Replace 'move' names (MDFLogicalName, LDFLogicalName) with those found in  
-- the previous filelistonly command

restore database hat
from disk = N'E:\Backups\hat0.bak'  and N'E:\Backups\hat1.bak'  
with move 'hat_Data' to 'J:\MDFs\hat.mdf',
     move 'hat_Log' to 'I:\Data\hat.ldf',
replace, stats=10;
ASKER CERTIFIED SOLUTION
Ephraim Wangoya
Software Engineer

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros