Error prompt]
Data cannot be retrieved for this request. (Microsoft. SqlServer. SmoEnum) an exception occurs when other information is executed in a Transact-SQL statement or batch. (Microsoft. SqlServer. ConnectionInfo) when you try to open or Create the physical file "d: Data ***. mdf", the Create file encounters an operating system error 5 (access denied .)
[Problem background]
Database version: SQL Server 2005 Enterprise Edition
Operating system version: Windows Server 2003 Enterprise Edition
Error Description: after the database is separated, the data hard disk is mounted from one host to another (the operating system and database version of the two hosts are the same ). The above error is prompted when the result is appended to the database.
[Problem analysis]
Obviously, this is caused by insufficient file operation permissions.
[Solution]
You can solve the problem by adding corresponding users to the folder attribute security of the database file and granting them full operation permissions (this is what we say on the Internet ). Who can add permissions? For example, the Administrators User Group, network service, MSSQLUser, or Everyone user can be directly added if it is unclear or lazy. I was trying to take a screenshot. I don't know why, even images of dozens of Kb have never been uploaded successfully.
[Unexpected situation]
You may use the above solution to add the corresponding user and Operation permissions to the folder where the data file is located, but the problem persists (this is what I am struggling, why can't I do this on the Internet ~~??!). Finally, my solution is to set user and Operation permissions for each database file (including mdf, ldf, and ndf) (the operation method is the same as adding operation permissions to folders, are all security options in the right-click attribute ). The problem was finally completely solved. The reason should be that the folder permission is not automatically inherited to the files in it.