There was an error when separating the database .mdf file and importing a new database to the SQLServer attached database. For more information, click the hyperlink in the "Message" column.

1. Separation of database .mdf files

1. First check the location of your database, right-click the database and click "Properties"
Insert picture description here
2. Click "File" to view the storage location of the
Insert picture description here
database 3. Right-click the database and click "Task" → "Separate" in turn
Insert picture description here
4. Check the following two items , And click OK
(Note: This will cause the current database to be closed and unavailable)
Insert picture description here
5. After clicking "OK", the current database no longer exists in the sql list.
Follow the database storage location in step one, copy the .mdf and .ldf files to the location you want,
I copied it to the root directory of the D drive, and then demonstrate adding the database.
My computer is in the DataBase directory of the E drive
Insert picture description here

Second, the import of the database

1. Right-click the database and click "Add"
Insert picture description here
2. Click "Add" and find the directory where the .mdf file is located
Insert picture description here
3. Check the file path is correct and click "OK"
Insert picture description here
4. The database is added successfully

5. If the addition is incorrect , Suggesting the following error,

Error while attaching database to SQLServer. For more information, click the hyperlink in the "Message" column.

The solution reference blog
https://blog.csdn.net/weixin_37590454/article/details/91411683
Insert picture description here

Hirofumi Honpo Reference Hakubun
https://blog.csdn.net/weixin_37590454/article/details/91411683

Published 18 original articles · praised 0 · visits 233

Guess you like

Origin blog.csdn.net/qq_39217004/article/details/105347483