我有一张sql-server-2016的桌子
CREATE TABLE #tempData (A int not null)
INSERT INTO #tempData VALUES (0);
GO现在,我可以调用我的R-脚本,将表作为输入数据(包括。(列名):
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)
);返回:
A B
0 1如预期的那样。但是,我可以在不指定名称{A,B}的情况下进行同样的操作,即它将直接使用来自data.frame的名称。
发布于 2017-04-03 23:57:12
不幸的是,随着BxlServer如何在BxlServer中转换R,您必须设置变量并键入结果集。
发布于 2015-12-30 04:58:26
根据当前文档(https://msdn.microsoft.com/en-us/library/mt604368.aspx),这似乎是不可能的。
WITH RESULTS SETS clause is mandatory if you are returning a result set from R . The specified column data types need to match the types supported in R (bit, int, float, datetime, varchar)https://stackoverflow.com/questions/34512148
复制相似问题