Tuesday, March 27, 2012

Attach db ... but changing its db name

I've a copy of my customer db detached from its server.
I need to import into my SQL to compare data and structure with my
own to release him some new feature. Problem is how to import it.
If I simple attach db, SQL server mustn't do it, trapping duplicate
db name or something else (I wish is so and not overwrite db).
If I detach my db, and attach customer db ... I must rename db ...
but how? until today I never read of some function that rename
db ...
Can anyone give me more info please?
--
Sincerely
Andrea Morowhile attaching db with sp_attach_db you can specify the required name of
the database to be. If you want to rename the existing database you can make
use of system stored proceudre sp_renamedb
--
-Vishal
Andrea Moro <moroandreaET@.tiscalinet.it> wrote in message
news:#kH0j9LcDHA.1204@.TK2MSFTNGP12.phx.gbl...
> I've a copy of my customer db detached from its server.
> I need to import into my SQL to compare data and structure with my
> own to release him some new feature. Problem is how to import it.
> If I simple attach db, SQL server mustn't do it, trapping duplicate
> db name or something else (I wish is so and not overwrite db).
> If I detach my db, and attach customer db ... I must rename db ...
> but how? until today I never read of some function that rename
> db ...
> Can anyone give me more info please?
> --
> Sincerely
> Andrea Moro
>sql

No comments:

Post a Comment