这可能有一个简单的答案,但我无法弄清楚,因为我仍然掌握在 SQL Server 中使用 R 的窍门。我有一段代码从 SQL Server 表中读取数据,在 R 中执行并返回一个数据框。
execute sp_execute_external_script
@language=N'R',
@script=N'inp_dat=InputDataSet
inp_dat$NewCol=max(inp_dat$col1,inp_dat$col2)
new_dat=inp_dat
OutputDataSet=new_dat'
@input_data_1=N'select * from IM_COMP_TEST_SQL2016.dbo.temp_table';
Run Code Online (Sandbox Code Playgroud)
我想将 new_dat 插入 SQL Server 表 ( select * into new_table from new_dat)。我该怎么做?