Last post Nov 09, 2017 06:38 AM by Deepak Panchal
Nov 09, 2017 06:03 AM|asp.ambur|LINK
I Have One Database For Example ShoppingApp
I have This SQL DB In Three Clients
Now Each client has same and different Table and store procedure
If i want to work in production server then I have to copy and replace each DB
So i what i did is i change name of DB and paste it in DATA folder and i click attach im getting this error
cannot attach a database with the same name as an existing database
for example i want like this below
How To do so..?
I want this all 3 db to be attach in my pc to use.
How to do so using SQL Server 2008 R2
Nov 09, 2017 06:38 AM|Deepak Panchal|LINK
you can follow the steps below.
Connect to the Database Engine.
From the Standard bar, click New Query.
Copy and paste the following example into the query window and click Execute. This example changes the name of the AdventureWorks2012
database to Northwind.
ALTER DATABASE AdventureWorks2012
Modify Name = Northwind ;
Note : - Requires ALTER permission on the database.
Rename a Database
by this way you can rename the original database.
but if you don't want to rename the original database then you can try to use backup and restore and copy the database with new name.
BACKUP DATABASE AdventureWorks2012
TO AdventureWorksBackups ;
FROM AdventureWorksBackups ;
RESTORE DATABASE TestDB
WITH MOVE 'AdventureWorks2012_Data' TO 'C:\MySQLServer\testdb.mdf',
MOVE 'AdventureWorks2012_Log' TO 'C:\MySQLServer\testdb.ldf';
Copying a database using BACKUP and RESTORE