Today, in an attachment to a previous database (not in the directory where SQL Server was initially installed), there is always a 5123 error code, as shown in the figure:
Initially thought it was SqlServer2008 incompatible with the original database, because the database is not known that the version was created, in the official looked at, explained that the permissions are not right, should put this database in the directory of SQL Server installation, that is, X:\Program Files\Microsoft SQL Server\mssql10. Mssqlserver\mssql\data, sure enough to solve the problem, but can not always put the database in this directory Ah! So I looked for other solutions;
The first solution : Just the method, put this file in the SQL Server default location, but it is best not to put in the C disk, in the event of reloading the system that day, the play is over, haha;
The second solution is to change the default database folder for the SQL Server Real column, select the SQL Server instance, right-click the property, have a "database setting" on the left, and click on the "database default location", and set this to your own directory.
The third solution is to change the permissions of the folder where the database is located, add a user of everyone, set to "Full Control" permission, it is OK, this program is direct and convenient;
Cloud Habitat Small Series think, local test, the recommended use of the third, the server, or to do a set of permissions.