I have a table in sql-server-2016
:
CREATE TABLE #tempData (A int not null)
INSERT INTO #tempData VALUES (0);
GO
Now I can call my R-script having the table as the input data (incl. column names):
EXECUTE sp_execute_external_script
@language = N'R'
, @script = N'
df <- InputDataSet
df$B <- 1L'
, @input_data_1 = N'SELECT * FROM #tempData'
, @output_data_1_name = N'df'
WITH RESULT SETS (
(A int not null, B int not null)
);
Returning:
A B
0 1
as expected. But can I do the same without specifying the names, {A,B}, i.e. it will use the names from the data.frame
directly.
Unfortunately with how BxlServer translates R in SQL Server today, you have to set the variable and type in RESULTS SET.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With