jbotts
asked on
How do I attach a database to an instance of SQL Server 2005 Express?
Experts: I am trying to attach the sample database AdventureWorks to an instance of SQL Server 2005 Express. Using the following code:
USE MASTER
GO
CREATE DATABASE AdventureWorks
ON PRIMARY (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ AdventureW orks_Data. mdf')
FOR ATTACH
GO
I get a message:
Msg 5120, Level 16, State 101, Line 2
Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\ AdventureW orks_Data. mdf". Operating system error 5: "5(Access is denied.)".
I have checked the properties of the file and it is not read only. Would appreciate your assistance.
USE MASTER
GO
CREATE DATABASE AdventureWorks
ON PRIMARY (FILENAME = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
FOR ATTACH
GO
I get a message:
Msg 5120, Level 16, State 101, Line 2
Unable to open the physical file "C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\
I have checked the properties of the file and it is not read only. Would appreciate your assistance.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I don't know why this worked, buit it did.
Thanks,
Jim Botts
Thanks,
Jim Botts
@physname = 'C:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\Data\