Today, when attach a previous database (not in the directory where sqlserver is initially installed), it is always unable to be attached, and there is always a 5123 error.Code,
At first, I thought it was because sqlserver2008 was not compatible with the original database because the database was not known to be created in that version. I read it on the official website and explained that the permission was incorrect, put the database in the directory where sqlserver is installed, that is, X: \ Program Files \ Microsoft SQL Server \ mssql10.mssqlserver \ MSSQL \ data, which solves the problem; however, you cannot put the database in this directory every time! So I found other solutions;
Solution 1: Put the file in the default location of sqlserver, but it is best not to put it on the drive C. If the system is reinstalled that day, it will be over, haha;
Solution 2: Change the default database folder in the sqlserver real column, select the sqlserver instance, right-click the attribute, and click "database Settings" on the left, there is a "default database location". set this to your own directory.
Solution 3: Change the permissions of the folder where the database is located. Add an Everyone user and set it to "full control". This solution is direct and convenient;
Tag: Additional database, 5123, attachdatabase, error5123