Excuse my dumb question, I am new to SQL.
Can I change the name of a database once I have created it?
And if so, how?
ThanksYes...take a look at the system stored procedure
sp_renamedb.
EXEC sp_renamedb 'CurrentDBName', 'NewDBName'
You can find more information on this stored procedure in
books online.
-Sue
On Mon, 8 Mar 2004 14:26:46 -0000, "Keith" <@..> wrote:
>Excuse my dumb question, I am new to SQL.
>Can I change the name of a database once I have created it?
>And if so, how?
>Thanks
>|||Use "sp_renamedb"
--
HTH,
SriSamp
Please reply to the whole group only!
http://www32.brinkster.com/srisamp
"Keith" <@..> wrote in message news:eu3GelRBEHA.2796@.TK2MSFTNGP09.phx.gbl...
> Excuse my dumb question, I am new to SQL.
> Can I change the name of a database once I have created it?
> And if so, how?
> Thanks
>
>|||Keith
You can also use 'Alter database' with 'Modify Name' parameter.
As Microsoft are moving more towards doing changes with the alter statement
it is worth being aware of this.
Regards
John|||Hi,
Ensure that no users are accessing the database, You will get the below
error incase any connection exists for the database
"Server: Msg 5030, Level 16, State 2, Line 1
The database could not be exclusively locked to perform the operation."
Detailed steps to rename the database with commands to rename PUBS database
to PUBS1
How to remove connections
--
Alter database pubs set single_user with rollback IMMEDIATE
Rename the database
--
Alter database pubs modify name = pubs1
Set multi user
--
Alter database pubs1 set multi_user
Thanks
Hari
MCDBA
"John Bandettini" <anonymous@.discussions.microsoft.com> wrote in message
news:29869442-685D-452C-BE50-4C4A8A39888C@.microsoft.com...
> Keith
> You can also use 'Alter database' with 'Modify Name' parameter.
> As Microsoft are moving more towards doing changes with the alter
statement it is worth being aware of this.
> Regards
> John|||Thank you everyone
"Keith" <@..> wrote in message news:eu3GelRBEHA.2796@.TK2MSFTNGP09.phx.gbl...
> Excuse my dumb question, I am new to SQL.
> Can I change the name of a database once I have created it?
> And if so, how?
> Thanks
>
>
Showing posts with label excuse. Show all posts
Showing posts with label excuse. Show all posts
Tuesday, March 20, 2012
Subscribe to:
Posts (Atom)