Change Database Name

Source: Internet
Author: User
To rename a database, use the system stored procedure sp_renamedb. The syntax is as follows:
Sp_renamedb [@ old_name =] 'old _ name', [@ new_name =] 'new _ name'
Example 6-12: change the name of the mydb database to "my DB ".
Exec sp_renamedb 'mydb', 'mydb'
The running result is as follows:
The database name 'my db' has been set.
Note:Before using this command, set the database access option to single user mode and disable the database. After changing the database name, the original database name is still displayed in Enterprise Manager. Only the "databasee" directory folder is selected, and then click "refresh" in the toolbar, the changed database name is displayed only after you refresh the page or restart SQL Server. The database is case-insensitive.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.