Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

Activate Command Prompt from Stored Procedure

$
0
0

Hi I am connecting Sql Server and R together to perform some Statistical Analysis.

The R script creates some plots which are Saved as Jpg into a SQL database which can be used for reports etc.

Using the Command Prompt and the following code

"C:\Program Files\R\R-3.0.2\bin\R.exe" CMD BATCH --vanilla --slave "C:\Users\Team Stinky\Documents\code.R"

opens the program and runs the code and the database is updated.

I have read the using xp_cmdshell will call the command prompt and run the above code (I have enabled xp_cmdshell)

So I want to use some code (later as a stored procedure) to be able to do this.

This is the code I am using

declare @cmd varchar(200)

set @cmd =  '<"C:\Program Files\R\R-3.0.2\bin\R.exe" CMD BATCH --vanilla --slave "C:\Users\Team Stinky\Documents\code.R"'

Exec Master..xp_cmdshell @CMD, NO_OUTPUT

It show that the command has run successful but the result of my table have not updated.

Where am I going wrong or is there any other way to achieve this?

Regards





Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>