Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 move with xp_cmdshell

Author  Topic 

Ajdin
Starting Member

2 Posts

Posted - 2014-10-17 : 09:17:45
Hi,

DECLARE @cmdstr as varchar(128)

set @cmdstr='MOVE /Y \\Mobispu\old\IGST_0104.TXT \\Mobispu\old\Test\IGST_0104.TXT'

print @cmdstr
EXEC master..xp_cmdshell @cmdstr

OUTPUT : 'Access is denied.'

NOTE: I've given 'full control' permission on both folders.

Please advice.

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-10-17 : 09:33:47
It's not about folder permission. It's about the account the command runs under on sql server. Often these accounts do not have permission to access remote directories.

If it were me, I'd write a little SSIS package to do the work, set up a Sql Server agent job to run it under a proxy that has appropriate network access. Or, run it with DTEXEC with an appropriate account.
Go to Top of Page

Ajdin
Starting Member

2 Posts

Posted - 2014-10-17 : 09:39:28
At the local files works ok, but when I Move a file in the network appears this error..
Go to Top of Page

gbritton
Master Smack Fu Yak Hacker

2780 Posts

Posted - 2014-10-17 : 10:08:19
Yes, its just what I told you. the account running the command (not your login!) does not have permissions on the network
Go to Top of Page
   

- Advertisement -