Kirk Dev Jr
Kirk Dev Jr

Reputation: 9

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?

Upvotes: 0

Views: 817

Answers (2)

Pintu Kawar
Pintu Kawar

Reputation: 2156

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

Upvotes: 0

TheGameiswar
TheGameiswar

Reputation: 28890

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

Upvotes: 0

Related Questions