tommym121
asked on
SQL - Attach Database Error
I am running SQL 2008 Developer version. I download 'AdventureWorks2008_Databa se.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\AdventureW orks2008_D atabase\Ad ventureWor ks2008_Dat a.mdf'), (FILENAME = 'C:\Users\Tommy\Documents\ SQL Server Management Studio\Projects\AdventureW orks2008_D atabase\Ad ventureWor ks2008_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\AdventureW orks2008_D atabase\Ad ventureWor ks2008_Dat a.mdf" failed with the operating system error 5(Access is denied.).
The content of the AdventureWorks2008_Databas e.zip is in the attached file
AdventureWorks2008Database.JPG
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\
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\
The content of the AdventureWorks2008_Databas
AdventureWorks2008Database.JPG
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
ASKER
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.
ASKER
tHANKS
ASKER
Thanks
ASKER
AdventureWorks2008DatabasePath.JPG