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.