Site icon R-bloggers

Enabling sp_execute_external_script to run R scripts in SQL Server 2016

[This article was first published on R – TomazTsql, and kindly contributed to R-bloggers]. (You can report issue about the content on this page here)
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.

SP_EXECUTE_EXTERNAL_SCRIPT is a stored procedure that execute provided script as argument on external script to a provided language (in this case R language). To enable normal function of this external stored procedure, you must have administrator access to your SQL Server instance in order to run sp_configure command (and set following configuration):

EXECUTE sp_configure;
GO

To enable execution of external script add an argument:

EXECUTE sp_configure 'external scripts enabled', 1;
GO

And after that run the reconfiguration as:

RECONFIGURE;
GO

This is a standard procedure to do so, also described on BOL for running sp_execute_external_script.

But I have seen too many people struggling with this; after running this reconfigure on sp_configure they still get run value for external scripts enabled set to 0.

Which literally means that execution of R script will not work.

In this case go to services and restart service: SQL Server Launchpad (SQLSERVER).

 

And this will take affect that run_value will be set to 1.

Enjoy coding T-SQL and R.


To leave a comment for the author, please follow the link and comment on their blog: R – TomazTsql.

R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.