尝试在 power bi 中实现 r 脚本以更新 SQL Server 数据库 [英] Trying to implement a r script within power bi to update a SQL Server database
问题描述
我正在尝试在 power bi 中实现一个 r 脚本来更新 SQL Server 数据库.我一直遇到这个问题……有人知道我该如何解决这个错误吗?
库(RODBC)输出帧=数据.帧(数据集)DBHANDLE<-odbcDriverConnect('driver={SQL Server};server=____;database=___;trusted_connection=true')TBLExist="sbs.Iterations" %in% sqlTables(DBHANDLE)$TABLE_NAME如果(!TBLE存在)sqlSave(DBHANDLE, data.frame(dataset), tablename = "sbs.Iterations",rownames=FALSE, append = FALSE)
<块引用>
DataSource.Error: ADO.NET: R 脚本错误.启动期间 - 警告消息:在setJsonDatabasePath(system.file("extdata/capabilities.json", :字节码版本不匹配;在 type.convert(data[[i]],as.is = as.is[i], dec = dec, numerics = numerics, : 无效输入'[Adhoc] [C2R]:当用户从 Main 点击 🙂(提供反馈)时UI,用户无法看到提交按钮.在 'utf8towcs' 调用中:read.csv -> read.table -> type.convert 执行暂停详情:DataSourceKind=R DataSourcePath=R Message=R 脚本错误.中启动 - 警告消息:在setJsonDatabasePath(system.file("extdata/capabilities.json", :字节码版本不匹配;在 type.convert(data[[i]],as.is = as.is[i], dec = dec, numerics = numerics, : 无效输入'[Adhoc] [C2R]:当用户从 Main 点击 🙂(提供反馈)时UI,用户无法看到提交按钮.在 'utf8towcs' 调用中:read.csv -> read.table -> type.convert 执行停止错误代码=-2147467259ExceptionType=Microsoft.PowerBI.Scripting.R.Exceptions.RScriptRuntimeException
尝试将源查询中的所有 CHAR
和/或 VARCHAR
数据类型转换为 NCHAR
和 NVARCHAR
分别.如果您的源数据包含任何 ASCII 字符代码为 128 或以上(尤其是 192 或以上)的字符,您可能会遇到字节码版本不匹配"错误.
这里有一些额外的阅读:sp_execute_external_script 和字节码版本不匹配
I'm trying to implement a r script within power bi to update a SQL Server database. I keep running into this problem... anyone know how I can resolve the error?
library(RODBC)
outputframe=data.frame(dataset)
DBHANDLE<-odbcDriverConnect('driver={SQL Server};server=____;database=___;trusted_connection=true')
TBLExist="sbs.Iterations" %in% sqlTables(DBHANDLE)$TABLE_NAME
if (!TBLExist)
sqlSave(DBHANDLE, data.frame(dataset), tablename = "sbs.Iterations",rownames=FALSE, append = FALSE)
DataSource.Error: ADO.NET: R script error. During startup - Warning message: In setJsonDatabasePath(system.file("extdata/capabilities.json", : bytecode version mismatch; using eval Error in type.convert(data[[i]], as.is = as.is[i], dec = dec, numerals = numerals, : invalid input '[Adhoc] [C2R]:When user clicks on 🙂(Provide feedback) from Main UI, User is not able to see submit button.' in 'utf8towcs' Calls: read.csv -> read.table -> type.convert Execution halted Details: DataSourceKind=R DataSourcePath=R Message=R script error. During startup - Warning message: In setJsonDatabasePath(system.file("extdata/capabilities.json", : bytecode version mismatch; using eval Error in type.convert(data[[i]], as.is = as.is[i], dec = dec, numerals = numerals, : invalid input '[Adhoc] [C2R]:When user clicks on 🙂(Provide feedback) from Main UI, User is not able to see submit button.' in 'utf8towcs' Calls: read.csv -> read.table -> type.convert Execution halted ErrorCode=-2147467259 ExceptionType=Microsoft.PowerBI.Scripting.R.Exceptions.RScriptRuntimeException
Try casting all of the CHAR
and/or VARCHAR
data types in your source query to NCHAR
and NVARCHAR
respectively. If your source data contains any characters with ASCII character codes of 128 or above (and in particular, 192 or above), you may encounter the "bytecode version mismatch" error.
Some additional reading here: sp_execute_external_script and Bytecode Version Mismatch
这篇关于尝试在 power bi 中实现 r 脚本以更新 SQL Server 数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!