none
SQL Server R Services stored procedures inputs

    Question

  • Apologies if this is the wrong place for SQL Server R Services questions. It appears that product does not have it's own section. 

    I'm trying to create my first example stored procedure using the sqlrutils package. The documentation helped me get going, and I've been editing the examples to move them closer to what I am needing to do. However I've run into some mysterious things happening which I don't understand. Let's take this working example that creates a simple stored proc with one input parameter:

    library(sqlrutils)

    testfunc <- function(multiplier)
    {
      iris_dataset <- iris
      iris_dataset$Sepal.Length <- iris_dataset$Sepal.Length * multiplier
      out <- 5.1
      # list(iris_dataset=iris_dataset, out=out)
      return(iris_dataset)
    }

    inparam <- InputParameter("multiplier", "numeric")


    sp <- StoredProcedure(testfunc, "spTestFunc",  inparam,                                            #function to create into a S.P. and the S.P. name
                          OutputData("iris_dataset"),
                          # OutputParameter("out", "numeric"),
                          connectionString=paste("Driver={ODBC Driver 13 for SQL Server};",
                                                 "Server=EUR-RISKDBTST02;Database=RSandbox;",
                                                 "Trusted_Connection=Yes;", sep = "")
                          )

    registerStoredProcedure(sp)

    In this example I've labeled the input `multiplier` both in the function and in the InputParameter creation. When I run this, however, the resulting stored procedure has an input named `multiplier_outer` Where did the suffix "_outer" come from? I see no mention of that in the docs...


    • Edited by JD Long Friday, June 16, 2017 4:34 PM your code formatter is bad and you should feel bad
    Friday, June 16, 2017 4:31 PM

All replies