"SQL System.Data.SqlClient.SqlError: Unable to overwrite file ' C:\Program Files\Microsoft SQL Server\mssql\data\itsm_" When restoring a database backup Data.mdf '. The database ' my1 ' is using the file ' problem.
Cause: When restoring a database backup file in two databases, this problem occurs primarily because restoring the first database is the same as the name of the second database, and the path is the same as the first database restore path when the second database is restored with a physical path.
Solution: 1. Name the second database to be different from the first one. Make a note of the location where you just created the second database.
2. Right click on the newly created database, restore operation, pop up the following window, select the path of the backup file on the original device, select the database restore file.
3. Click "Options" on the left. Pop:
Choosing the path in the red box to match the path you just built the database is the key to solving the problem.
4. Two paths Select the location of the database you just built
After modifying the path, the restore operation will not error.
SQL System.Data.SqlClient.SqlError: Cannot overwrite file ' C:\Program Files\Microsoft SQL Server\mssql\data\itsm_data.mdf '. The database ' my1 ' is using the solution for this file