Link to home
Create AccountLog in
Avatar of tommym121
tommym121Flag for Canada

asked on

SQL - Attach Database Error

I am running SQL 2008 Developer version.  I download 'AdventureWorks2008_Database.zip'
After I unzip it ,  I start SSMS under Administrator and try to use the following command to create the database.

CREATE DATABASE AdventureWorks2012 ON (FILENAME = 'C:\Users\Tommy\Documents\SQL Server Management Studio\Projects\AdventureWorks2008_Database\AdventureWorks2008_Data.mdf'), (FILENAME = 'C:\Users\Tommy\Documents\SQL Server Management Studio\Projects\AdventureWorks2008_Database\AdventureWorks2008_Log.ldf') FOR ATTACH;

I get an error.  Can anyone tell me why I get such an error

Msg 5133, Level 16, State 1, Line 2
Directory lookup for the file "C:\Users\Tommy\Documents\SQL Server Management Studio\Projects\AdventureWorks2008_Database\AdventureWorks2008_Data.mdf" failed with the operating system error 5(Access is denied.).

The content of the AdventureWorks2008_Database.zip is in the attached file
AdventureWorks2008Database.JPG
Avatar of tommym121
tommym121
Flag of Canada image

ASKER

The path where I unZip is in the attached files
AdventureWorks2008DatabasePath.JPG
ASKER CERTIFIED SOLUTION
Avatar of deviprasadg
deviprasadg
Flag of India image

Link to home
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
See answer
Thanks it works.  Why can I not put under other directory?
SQL Server Service account does not have access on the user Folders by default, hence you are getting this error.
tHANKS
Thanks