1. Separation of database .mdf files
1. First check the location of your database, right-click the database and click "Properties"
2. Click "File" to view the storage location of the
database 3. Right-click the database and click "Task" → "Separate" in turn
4. Check the following two items , And click OK
(Note: This will cause the current database to be closed and unavailable)
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
Second, the import of the database
1. Right-click the database and click "Add"
2. Click "Add" and find the directory where the .mdf file is located
3. Check the file path is correct and click "OK"
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
Hirofumi Honpo Reference Hakubun
https://blog.csdn.net/weixin_37590454/article/details/91411683