March 3, 2010 at 10:46 am
Hi , I have database saying DB1 on the production server, when i take a backup of my production db n attaching to my devserver, it is giving me errors.So i am copying over the mdf,ldf files and attaching them.But when i need a new copy of the DB1 , i have to detach the old version of DB1 it is saying i cannot attach 2 databases of same name eventhough i am renaming the mdf,ldf files.Please suggest me how can i retain the old DB1 on dev server and attach a new version of DB1.
March 3, 2010 at 11:25 am
when you resotre, or when you attach, you have the option to change the database name; it would fail of course if there is already a database with that name;
if you are attaching, just change the name here:
or in TSQL:
USE [master]
GO
CREATE DATABASE [NewDatabaseName] ON
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\SandBox.mdf' ),
( FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\SandBox_log.LDF' )
FOR ATTACH
GO
here's where you change the name when selecting a backup file:
Lowell
March 3, 2010 at 8:13 pm
Thanks, will try it and let you know the results. Thanks for the answer
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply