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.
Author |
Topic |
eugz
Posting Yak Master
210 Posts |
Posted - 2007-05-04 : 12:09:35
|
Hi All.I just start to use SQL2005 and don't know how attach .mdf file's database and change name of database at the same time?Thanks. |
|
NeilG
Aged Yak Warrior
530 Posts |
Posted - 2007-05-04 : 12:18:34
|
Why don't you just attach the db and then run sp_renamedb |
|
|
pootle_flump
1064 Posts |
Posted - 2007-05-04 : 12:26:23
|
I think I would do the same. If you really want to do it in one action then I *think* you can do this with the new CREATE DATABASE... syntax. Not sure though - never done it. Have a look in BoL for details - I couldn't spot anything that implied you could not do this. |
|
|
harsh_athalye
Master Smack Fu Yak Hacker
5581 Posts |
Posted - 2007-05-04 : 12:35:57
|
Create Database...For Attach would be my guess.Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
|
|
Kristen
Test
22859 Posts |
Posted - 2007-05-04 : 12:36:39
|
Would it also be a good idea to think about changing the logical names?Personally I always use RESTORE for this type of job as I'm more familiar with it, and thus consider all the naming issues as part of the restore process. Mind you, that's no help if what you have got is a detached database Kristen |
|
|
eugz
Posting Yak Master
210 Posts |
Posted - 2007-05-04 : 15:11:06
|
Thanks a lot everyone.The decision is very simple. When you attach a database and select file which you want to attach click name under column ATTACH AS. And type your database name. |
|
|
|
|
|