SQL: the logical file name 'A' has been used, and the database name 'A' has been used.

Source: Internet
Author: User

When a database is created, the creation statement is re-executed because the database is not standardized and you want to change the database path. After the database is detached, the following statements are executed:Code:

 

Code
If   Exists ( Select   *   From SYS. sysdatabases Where Name = ' Clubweb ' )
Begin
Use Master
Drop   Database Clubweb
End
Go

Create   Database Clubweb
On
(Name = N ' Clubweb ' , Filename = N ' E: \ clubweb \ app_code \ database \ clubweb. MDF ' , Size = 3 MB, maxsize = Unlimited, filegrowth = 1 )
Log   On
(Name = N ' Clubweb_log ' , Filename = N ' E: \ clubweb \ app_code \ database \ clubweb. LDF ' , Size = 3 MB, maxsize = Unlimited, filegrowth = 1 )

Go

 

The logic name has been used and the method of modifying the logic name is used:

Alter database name
Modify file (name = original logical file name, newname = new logical file name)

It is also reported that the database name has been used, and the method of changing the database name is used:

Alter database original database name
Modify name = new database name

In the object resource manager, you can change the name of the new database and run the above code to create a new database.

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.