Hi All,
I'm new in shell have problem run .bat in store proc ,.bat working manually ,but in sp no
my sp:
DECLARE @CMDSQL VARCHAR(1000)
SET @CMDSQL = '\vsrv-ad01\Public\IT\Evgeny\CopyReports.bat'
EXEC master..xp_cmdshell @CMDSQL
what wrong?
Thanks for help
Who/what user is making the proc call?
Does it have permissions to \vsrv-ad01\Public\IT\Evgeny\ folder?
I would like after that schedule that sp, so sqlAgent
after running the sp I have message
NULL
C:\Windows\system32>XCOPY
Invalid path
0 File(s) copied
NULL
how are you running the sp?
and when you will deploy it as a sql job, which user will be running the sql job?
Shoud be:
DECLARE @CMDSQL VARCHAR(1000)
SET @CMDSQL = '\\vsrv-ad01\Public\IT\Evgeny\CopyReports.bat'
EXEC master..xp_cmdshell @CMDSQL
Jotorre, I think that was due to the forum, it strips out double back slash
Sorry ,but I received same result
NULL
C:\Windows\system32>XCOPY /s /e /d /y "\vsrv-ad01\Public\IT\Evgeny\Canada\11A - SUKH HEER -IRIS" "
Invalid path
0 File(s) copied
NULL
yosiasz
11
your issue has nothing to do with sql server but with xcopy.
so,what 's wrong ,when I manualy run batch file its work correctly
Does the account sql server is running under have permissions on the path?
Its my file could you please take a look and let me know what's issue?
XCOPY /s /e "xxxxx" "xxx\OneDrive - xxxx"
If not grant impersonate on a windows account having permissions on the share and use execute as.