Search code examples
sql-serversql-server-2012mdf

How to attach my database file .mdf into my local SQL from the LAN network


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?


Solution

  • 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