0

I want to attach my .mdf file into my local sql from the other computer but sql throw the exception:

Directory lookup for the file "\DATA\SAGOHANO-Server\SQL\SaGoHaNo.mdf" failed with the operating system error 5(Access is denied.).

my code here:

CREATE DATABASE SaGoHaNo 
ON (FILENAME = '\\DATA\SAGOHANO-Server\SQL\SaGoHaNo.mdf'), 
(FILENAME = '\\DATA\SAGOHANO-Server\SQL\SaGoHaNo_log.ldf') 
FOR ATTACH;

Everyone may help me to fix my issue,please?

jarlh
  • 42,561
  • 8
  • 45
  • 63
  • Possible duplicate of [Attach a remotely stored database](http://stackoverflow.com/questions/15722551/attach-a-remotely-stored-database) – neer Aug 17 '16 at 12:20

2 Answers2

0

Error message is clear..

The Account under which SQLServer is running doesn't have access to the share in the question..Add the account and give appropriate permissions

TheGameiswar
  • 27,855
  • 8
  • 56
  • 94
0

Provide the complete Server location path like

FILENAME = '\\SERVERNAME\DATA\SAGOHANO-Server\SQL\SaGoHaNo.mdf'

OR Try

FILENAME = '\\SERVERNAME\D$\DATA\SAGOHANO-Server\SQL\SaGoHaNo.mdf'

D$ - $ sign after the drive Name

p2k
  • 2,126
  • 4
  • 23
  • 39
  • its LAN network path. I am so sorry because I dont know about servername . Please you can let me know about this? – Kirk Dev Jr Aug 17 '16 at 11:14