';R';在执行';sp_execute_external_脚本';
我正在尝试使用SQL server 2019中的R从文件夹中读取csv文件。当我运行R脚本时,我总是得到相同的错误,即: 执行“sp_execute_external_script”期间发生“R”脚本错误。发生外部脚本错误:文件(文件,“rt”)中出错:“description”参数无效 电话:来源。。。使用Visible->eval->eval->read.csv->read.table->file 这是我试过的代码:';R';在执行';sp_execute_external_脚本';,r,tsql,etl,R,Tsql,Etl,我正在尝试使用SQL server 2019中的R从文件夹中读取csv文件。当我运行R脚本时,我总是得到相同的错误,即: 执行“sp_execute_external_script”期间发生“R”脚本错误。发生外部脚本错误:文件(文件,“rt”)中出错:“description”参数无效 电话:来源。。。使用Visible->eval->eval->read.csv->read.table->file 这是我试过的代码: declare @resFilePath varchar(1000) se
declare @resFilePath varchar(1000)
set @resFilePath = 'C:/Temp';
create table #Results
(
id int,
name varchar(500)
);
insert into #Results (id , name)
EXEC sp_execute_external_script
@language = N'R',
@script = N'
filepath <- list.files(path = resFilePath, pattern = "*exact.csv", all.files = FALSE,
full.names = TRUE, recursive = TRUE,
ignore.case = FALSE, include.dirs = FALSE, no.. = TRUE)
res <- read.csv(filepath, sep="\t", quote="\"")
res <- as.data.frame(res)'
, @output_data_1_name = N'res'
, @params = N'@resFilePath varchar(1000)'
, @resFilePath = @resFilePath
select * from #Results
declare@resFilePath varchar(1000)
设置@resFilePath='C:/Temp';
创建表#结果
(
id int,
名称varchar(500)
);
插入#结果(id、名称)
EXEC sp_execute_外部_脚本
@语言=N'R',
@脚本=N'
文件路径