You can use SQL statements to attach an SQL Server 2000 database to change the physical and logical file names.

Source: Internet
Author: User
-- Attach a database

Sp_attach_db 'database name', 'database full path', 'database log full Path'
Go
Use Database Name

-- Specify the default database before adding a login

Exec sp_addlogin 'login name', 'Password', 'database name'
Go

-- Grant this logon permission to access the database

Exec sp_adduser 'username', 'username', 'db _ owner'
Go

-- Modify the logical file name (data) of the database)

Alter database new
Modify file (name = 'old _ data', newname = 'new _ data ')
Go

-- Modify the logical file name (log) of the database)

Alter database new
Modify file (name = 'old _ log', newname = 'new _ log ')
Go

Copy the above files to the SQL query analyzer, and modify the relevant name. The only drawback is that you can change the logical file name in the last two steps (in fact, you can do it without changing it ), you need to know what the previous name was. Generally, you may not know it. You only need to manually append it (not the real append, as long as you see this logical name, you can exit ), then write it on the top and press F5 to execute it. This will be depressing. I used to append the SQL statement for convenience, so it will be troublesome. If you have a better solution, I hope you will not be enlightened.

Related Article

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.