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
 General SQL Server Forums
 New to SQL Server Programming
 SQL 2000 Restore Mdf as different database

Author  Topic 

Vack
Aged Yak Warrior

530 Posts

Posted - 2015-03-30 : 14:48:54
I have a database named data.
I have a copy of the mdf file for that database.

Is it possible to attach that mdf as a different database without overwriting the existing mdf and ldf files?

bitsmed
Aged Yak Warrior

545 Posts

Posted - 2015-03-30 : 15:21:52
Something like:
exec sp_attach_db
@dbname=N'newname'
,@filename1=N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\oldname.mdf'
,@filename2=N'c:\Program Files\Microsoft SQL Server\MSSQL\Data\oldname_log.ldf'
Go to Top of Page

jackv
Master Smack Fu Yak Hacker

2179 Posts

Posted - 2015-03-31 : 01:45:34
Assuming it was detached correctly in the first place

Jack Vamvas
--------------------
http://www.sqlserver-dba.com
Go to Top of Page
   

- Advertisement -