Restore sql server express bak file as different db?

Restore sql server express bak file as different db?

am 24.08.2007 17:55:37 von nano

I have a bak file of a sql server express database from another server,
and I'd like to restore it to my dev box as a different database. Does
anyone know how to do this?

Re: Restore sql server express bak file as different db?

am 24.08.2007 23:49:34 von Erland Sommarskog

nano (nano@nano.ono) writes:
> I have a bak file of a sql server express database from another server,
> and I'd like to restore it to my dev box as a different database. Does
> anyone know how to do this?

First run

RESTORE FILELIST_ONLY FROM DISK = ''

Make a note of the logical files names. Then run:

RESTORE DATABASE db FROM DISK = ''
WITH MOVE '' TO '.mdf',
MOVE '' TO '.ldf',
REPLACE

See also the RESTORE command in Books Online. I might have confused
FILELIST_ONLY and HEADERONLY.

--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downlo ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books .mspx