I got a databse A. It has some data in it. I created a backup for A as A.bak file. Then I create a new empty database B. And then I try to restore B from A.bak. But the SQL Serve tell me the following error:
The file 'C:SQL DirectoryDATAA.mdf' cannot be overwritten. It is being used by database 'A'.
But if I delete A from SQL Server, the retore is ok.
I don't understand why the SQL needs to write to the original database file while restoring from a seperate backup file?