I found out how to solve this problem in SQL Sever. I used
PsExec together with
xp_Cmdshell to do the job. You have to install the
PsExec in Windows in the
system32 directory of the server machine. You can find the installer here. After that, I created this procedure, that can execute a file in a remote server:
CREATE PROCEDURE [dbo].[MAT_EXEC_SCRIPT]
WITH EXECUTE AS CALLER AS
Declare @command varchar(1000)
set @command='PsExec \\192.168.0.59 -u domain\login -p password -d C:\Rotinas\' + @scriptName
Exec Master..xp_Cmdshell @command
and this test bat file in the
Rotina folder, called
::Test bat file to call Mathematica Scripts
PATH = C:\Program Files\Wolfram Research\Mathematica\8.0;%PATH%
start MathKernel -script "C:\Scripts\mathScript00_Test.m"
Now I can execute the procedure as:
EXEC MAT_EXEC_SCRIPT 'exec.bat'
This will call the
bat file, which then calls the Mathematica script.
You can avoid this
bat file if you want, but I prefer to keep it separated, with the intermediate
bat file, so as to be better organized.