MS SQL Error 5123 attaching a database file.
I had to reattach a Microsoft SQL 2005 database file for someone this morning. I’ve had to do it several times for this database as they are doing lots of testing for it and like to detach it, backup it up and reattach it.
This morning however, it wouldn’t let me reattach it. The management studio gave me an error 5123 trying to open or create the file. After some research it turns out to be a permissions problem.
I checked the permissions on the file and the person who had detached the file was the only one with access. So I granted Everyone full access and I was then able to reattach the database.