保留sql-server-2016中输出表中data.frame中的列名

保留sql-server-2016中输出表中data.frame中的列名,sql-server,r,sql-server-2016,Sql Server,R,Sql Server 2016,我在sql-server-2016中有一个表: CREATE TABLE #tempData (A int not null) INSERT INTO #tempData VALUES (0); GO 现在,我可以调用以表作为输入数据(包括列名)的R脚本: 正如所料。但是我可以在不指定名称的情况下执行相同的操作,{A,B},即它将直接使用data.frame中的名称 根据当前的文档()这似乎是不可能的 WITH RESULTS SETS clause is mandatory if y

我在
sql-server-2016
中有一个表:

CREATE TABLE #tempData (A int not null) 
 INSERT INTO #tempData   VALUES (0);
GO
现在,我可以调用以表作为输入数据(包括列名)的R脚本:


正如所料。但是我可以在不指定名称的情况下执行相同的操作,{A,B},即它将直接使用
data.frame
中的名称

根据当前的文档()这似乎是不可能的

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)

不幸的是,现在在SQL Server中BxlServer如何翻译R,您必须设置变量并键入结果集。

谢谢您的回答。我确实读过这篇文章,但在我看来,这不一定是相同的。我知道set子句是必需的,因为我需要指定类型,但这不应排除从
data.frame
检索名称,或者?
A   B
0   1
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)