Error when running R in store proc sql Server

Hi,

I have a R script that works in Rstudio but when I exec the store procedure (as an external script in sql server) I get the following error:

Error in $<-.data.frame(*tmp*, outputresult, value = character(0)) :
replacement has 0 rows, data has 6098
Calls: source ... withVisible -> eval -> eval -> <- -> <-.data.frame

The strange thing is that I am only saving back to sql the model binary as a serialised model.

EXEC sp_execute_external_script
@language = N'R'
, @script = @User_script
, @input_data_1 = @input_data_1_Query
, @input_data_1_name = N'TotalTable'
, @params = N'@model_binary varbinary(max) OUTPUT'
, @model_binary = @model_binary OUTPUT

where

model_binary <- as.raw(serialize(tree, connection=NULL));

In a similar procedure, using the same inputs but saving more outputs to a sql table, I dont get an error.

any ideas??

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.